Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADODB Recordset across several Sub-Routines ??

Status
Not open for further replies.

suel

Programmer
May 9, 2002
13
GB
I am accessing a SQL2000 Db using VB6 front end. I need to be able to return a ADODB recordset in Sub_1, and then pass each record in that rs to another routine Sub_Validate
eg
Code:
Sub_1()
' open the recordset
set rs = new adodb.recordset
rs.open "select * from SQLtable1", DE1,cnn1

if rs.recordcount > 0 then
   rs.movefirst
do 
   validate (liError)  'Pass the first rec to sub Validate
   rs.movenext
   reccount = recount + 1
loop until rs.eof
end sub

Sub_validate()

If rs!Field1<> 999 or rs!field1 <> -1 then
  'write error log stuff
etc with remaining fields in each record
end if
Thanks




 
You can either define the record set in the declarations section of the form, giving it form-wide scope so that its accessable to all subs within the form.

Or you can pass the RecordSet as a parameter

validate (liError, rs)

Sub_validate(liError as Integer, rs as ADODB.Recordset)

... Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Cheers ! It worked a treat

Suel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top