How are field values in a recordset referenced?
Below is code that opens two recordsets.
A report is run based on a value in the first recordset matching a value in the 2nd record set. When I execute this code a prompt is displayed asking for the rstPM.[Program Manager]and [rstFindProj].[Program Manager] values. I have tried using the ! instead of the . to distinguish the field, but this did not work.
Please note, that I am not finished with this code. I intend to add logic to use the output to command (instead of the OpenReport command) to save the report to the harddrive. I use the OpenReport command for debugging purposes.
Thank you in advance for your help.
Private Sub cmd_PM_ProjNum_Click()
Dim dbMLV As Database
Dim rstPM As Recordset
Dim rstFindProj As Recordset
Dim strFileName As String
Dim strPMName As String
Set dbMLV = CurrentDb
Set rstPM = dbMLV.OpenRecordset("qry_PM_Proj_Num"
Set rstFindProj = dbMLV.OpenRecordset("qry_find_program_mgr"
If rstPM.RecordCount > 0 Then
Do While Not rstPM.EOF
DoCmd.OpenReport "PM_Proj_Num", acPreview, "", "[rstPM].[Program Manager]= [rstFindProj].[Program Manager]"
rstPM.MoveNext
Loop
MsgBox "Project Manager by Project Number Reports Completed."
End If
End
End Sub
Below is code that opens two recordsets.
A report is run based on a value in the first recordset matching a value in the 2nd record set. When I execute this code a prompt is displayed asking for the rstPM.[Program Manager]and [rstFindProj].[Program Manager] values. I have tried using the ! instead of the . to distinguish the field, but this did not work.
Please note, that I am not finished with this code. I intend to add logic to use the output to command (instead of the OpenReport command) to save the report to the harddrive. I use the OpenReport command for debugging purposes.
Thank you in advance for your help.
Private Sub cmd_PM_ProjNum_Click()
Dim dbMLV As Database
Dim rstPM As Recordset
Dim rstFindProj As Recordset
Dim strFileName As String
Dim strPMName As String
Set dbMLV = CurrentDb
Set rstPM = dbMLV.OpenRecordset("qry_PM_Proj_Num"
Set rstFindProj = dbMLV.OpenRecordset("qry_find_program_mgr"
If rstPM.RecordCount > 0 Then
Do While Not rstPM.EOF
DoCmd.OpenReport "PM_Proj_Num", acPreview, "", "[rstPM].[Program Manager]= [rstFindProj].[Program Manager]"
rstPM.MoveNext
Loop
MsgBox "Project Manager by Project Number Reports Completed."
End If
End
End Sub