Hello,
I have a process in my head that I know can be done, but alas, I don't know how to do it. Here are the specifics.
I have a table in SQL, call it "invoices." It only has one field, a pkey, used for other operations. What I want to do is store that table in a record set. Then I want to loop through that table performing specific operations for each pkey.
For example, the pkey that is passed into that table, would be used in a stored procedure first, then it would be used to print a report. Then I would want to loop to the next pkey and peform those same actions again and so on...
Here is the action that i want to have happen in the middle of the loop...
Dim ocmd As New Command
Dim sSQL As String
sSQL = "[dbo].[sp_GenerateInvRecTLD] " & ??pkey?? & ", '" & Me.GLDate & "'"
Set ocmd.ActiveConnection = CurrentProject.Connection
ocmd.CommandText = strsql
ocmd.Execute
Docmd.openreport "report Name", , ,"[pkey] = " & ??Pkey??
I have a process in my head that I know can be done, but alas, I don't know how to do it. Here are the specifics.
I have a table in SQL, call it "invoices." It only has one field, a pkey, used for other operations. What I want to do is store that table in a record set. Then I want to loop through that table performing specific operations for each pkey.
For example, the pkey that is passed into that table, would be used in a stored procedure first, then it would be used to print a report. Then I would want to loop to the next pkey and peform those same actions again and so on...
Here is the action that i want to have happen in the middle of the loop...
Dim ocmd As New Command
Dim sSQL As String
sSQL = "[dbo].[sp_GenerateInvRecTLD] " & ??pkey?? & ", '" & Me.GLDate & "'"
Set ocmd.ActiveConnection = CurrentProject.Connection
ocmd.CommandText = strsql
ocmd.Execute
Docmd.openreport "report Name", , ,"[pkey] = " & ??Pkey??