passing recordset to sub

  • Thread starter Thread starter alan fisher
  • Start date Start date
A

alan fisher

I have a procedure that updates a table with values from a
recordset and would like to handle the operation in a sub
since I do the same thing in several places within an
If..Then...Else statement. I created a sub called
UpdateEffectiveTable(rs as recordset). I then passed the
name of the recordset to the Sub. I am updating the
recorset with variables which are set in the main
procedure and during compile I get an error in the sub
because the variable is not recognized. Can I pull the
value of the variable from the Sub as opposed to passing
the value when I run it. Thanks for any help.
 
The variables that are defined in the main procedure will not be visible to
the called sub procedure unless (a) you define them as gloabl to both
procedures - bad, or (2) you explicitly pass them to the sub procedure, as
parameters (along with the recordset).

HTH,
TC
 
Back
Top