G
Guest
I do a name search for a specific record in a file using a form and query.
If I find the record I print a report using the name from the form and other
data from the file record. If the record is not found I want to print just
the data from the form. ID is the record id in the form & query and also in
the report.
My code is:
Private Sub Command61_Click()
If Forms!RecpInput.RecordsetClone.RecordCount = 0 Then
DoCmd.OpenReport "LabelsRecptInput", acViewPreview, "[ID]=null"
Else
DoCmd.OpenReport "LabelsRecptInput", acViewPreview, , "[ID]=" & Me![ID]
End If
End Sub
This works when a record is found but I get the report with a error when
no record is found.
If I find the record I print a report using the name from the form and other
data from the file record. If the record is not found I want to print just
the data from the form. ID is the record id in the form & query and also in
the report.
My code is:
Private Sub Command61_Click()
If Forms!RecpInput.RecordsetClone.RecordCount = 0 Then
DoCmd.OpenReport "LabelsRecptInput", acViewPreview, "[ID]=null"
Else
DoCmd.OpenReport "LabelsRecptInput", acViewPreview, , "[ID]=" & Me![ID]
End If
End Sub
This works when a record is found but I get the report with a error when
no record is found.