I found it and set it to Yes. However the result returned is still not filtered by selection entered in the Case box (see attached). I select the case # and click the button and all the results are returned. I only need the selected entry to be returned. Thank you
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
The above code saves the current input record on the form.
If the current record is not save, you will not be able filter to this record as it is not in the table.
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
This code is not neccesary once the record is saved.
Currently I open the report in a form using this code:
Private Sub cmdPrint_Click()
Dim strWhere As String
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[Case number] = " & Me.[Case number]
DoCmd.OpenReport "unrelated SCT1", acViewPreview, , strWhere
End If
End Sub
I am getting this error code: 2455 (screenshot attached)
is "unrelated SCT1" correct? Should it be "unrelatedSCT1" without space?
The error indicates or possibly caused by another source? Please confirm by debuging the code by inserting break points into all the lines of the event button. Or insert a error trapping.
If there's no error from the button event, then it's from another source.
Else you may have a potential corruption. Can you do a compact and repair?
Edit: Case is a reserved word in access as ALC had indicated.