Hello all,
I am having some trouble passing a recordset to a sub. I want to pass the recordset to Sub Patient, then pass the string PAT back up and write out the results, then loop through the recordset and do the same for all rows. I can do this if I list each datafield in the Call Patient () function, but I actually have 12 datafields to pass so I thought it would be easier to pass the entire recordset.
Here is some of the code as an example. Also, I just want to write out each row from the recordset on a different line one because I have three other Subs just like this one to write out as I loop through.
Public Sub Main()
Dim rsClaim as new adodb.recordset
Dim PAT as String
Dim Qst1 as String
Qst1 = "select firstname, lastname, ID, Region from Clients;"
rsClaim.MoveFirst
Do While not rsClaim.EOF
Call Patient(rsClaim, PAT)
Outfile.write PAT
rsClaim.MoveNext
Loop
End Sub
Public sub Patient(rsClaim as adodb.recordset, PAT)
Dim FName as String, LName, State, ZIP, PAT as String
FName = trim$(rsClaim!firstname)
LName = trim$(rsClaim!lastname)
State = "CA"
ZIP = "11155"
PAT = FName & LName & State & ZIP & "~"
End Sub
Can anyone tell me if this is possible without listing 12 datafields in the call like this:
Call Patient(rsClaim!firstname, rsClaim!lastname, rsClaim!City, rsClaim!Divison, rsClaim!Phone, rsClaim!Cell) etc...
Also, is there a limit to the number of variables you can pass?
Thanks for the help!! Have a good day at work too!