Can't use record set in sub-subs, Why?

RECrerar

Registered User.
Local time
Today, 10:35
Joined
Aug 7, 2008
Messages
130
I have a form that is used to populate a table with user defined options which are selected fomr two list boxes and a combo box (the combo box is just used to filter the second list)

Behind the form are lots of sections of repeated code so I wanted to put the repeated code samples into their own subs and then call them as and when necessary. However a lot of the code is based off a DAO recordset and I can't use this outside of a single sub procedure.

When I try and define the recordset outside of a sub it stops the cascading combo/listbox working and also none of the code works.

Why is this? I'm using Access 2003
 
You can pass a recordset between sub routines using the following

Call MySubroutine(RsSQL)


Sub MySubroutine(Rs As Recordset)

David
 
Thanks so much, I will give that a try, it will certainly make things much nicer
 

Users who are viewing this thread

Back
Top Bottom