I have a sub form (CURRENT BY CASE) at the bottom of my MAIN form(NCP/CP AUDIT). I would like to do this.
Preview on screen a report (CURRENT BY CASE RPT) of the subform data the record
currently displayed in the main form
Here is the code I have attempted to use unsuccessfully to view CURRENT BY CASE RPT:
Private Sub Command22_Click()
On Error GoTo Err_Command22_Click
Dim stDocName As String
stDocName = "CURRENT BY CASE"
DoCmd.OpenReport stDocName, acPreview, , "ID_CASE= forms! [NCP/CP AUDIT TBL]! ID_CASE"
Exit_Command22_Click:
Exit Sub
Err_Command22_Click:
MsgBox Err.Description
Resume Exit_Command22_Click
End Sub
I currently am getting a syntax error—“Invalid use of ‘.’,’!’,or ‘()’. In query expression ‘(ID_CASE=forms![NCP/CP AUDIT TBL]!ID_CASE)’
Attached is a screen shot of the Main and Sub Form
Thanks for the help