Rec. set lost 
Author Message
 Rec. set lost

I developed something in access to create a mail merge
table (later merged to word).  

When this form is loaded I do not want to populate
everything in the table .. so I created a recordset where
the letter date is within the last 2 months

Where is the best place to create this record set..
currently, I created this records set (rstLetter) in the
form load event of the main form.. but sometimes I loose
this rstLetter object when I load another form and come
backe to the main from.

Can I create the record set in any other places. so its in
the memeory till you close the main screen or quit
application.

Thanks.



Sun, 14 Aug 2005 10:11:32 GMT  
 Rec. set lost
Hi,
If you want the recordset to be available for the life of the form,
declare it in the declarations section, not within the Load event
because then your variable goes out of scope after the event
finishes processing.
If you want it available for the life of the application,
declare it as a public variable in a standard module.

--
HTH
Dan Artuso, MVP

"a problem well stated is a problem half solved"


Quote:
> I developed something in access to create a mail merge
> table (later merged to word).

> When this form is loaded I do not want to populate
> everything in the table .. so I created a recordset where
> the letter date is within the last 2 months

> Where is the best place to create this record set..
> currently, I created this records set (rstLetter) in the
> form load event of the main form.. but sometimes I loose
> this rstLetter object when I load another form and come
> backe to the main from.

> Can I create the record set in any other places. so its in
> the memeory till you close the main screen or quit
> application.

> Thanks.



Sun, 14 Aug 2005 19:49:55 GMT  
 Rec. set lost
 I did declare the variable as public in a stand alone
module. However, I cannot use Set db=currentdb or
set rstLetters = db.openrecordset("Select * from Letters")
in the module.  I have used these 'set' command in the
from load event. Is this wrong?

Quote:
>-----Original Message-----
>Hi,
>If you want the recordset to be available for the life of
the form,
>declare it in the declarations section, not within the
Load event
>because then your variable goes out of scope after the
event
>finishes processing.
>If you want it available for the life of the application,
>declare it as a public variable in a standard module.

>--
>HTH
>Dan Artuso, MVP

>"a problem well stated is a problem half solved"



>> I developed something in access to create a mail merge
>> table (later merged to word).

>> When this form is loaded I do not want to populate
>> everything in the table .. so I created a recordset
where
>> the letter date is within the last 2 months

>> Where is the best place to create this record set..
>> currently, I created this records set (rstLetter) in the
>> form load event of the main form.. but sometimes I loose
>> this rstLetter object when I load another form and come
>> backe to the main from.

>> Can I create the record set in any other places. so its
in
>> the memeory till you close the main screen or quit
>> application.

>> Thanks.

>.



Sun, 14 Aug 2005 23:35:59 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. changes to all records in one rec set based on position in another rec set

2. New Rec with previous Rec data

3. Perform a go to new rec w/ retaining some info from prev rec

4. Move to newrecord adds rec to db, but cant move to new rec

5. New Rec with previous Rec data

6. New Rec with Data Based on Previous Rec's Data

7. Setting up Outlook to send/rec email through Lan

8. Rec. sets

9. setting focus after adding a rec

10. setting up outlook to send/rec mail through lan


 
Powered by phpBB® Forum Software © phpBB Group