Good morning, I have a cmdButton and it is supposed to open a report on the current user being displayed in the form. Instead, I get an error, Data type mismatch in criteria expression. Here is the procedure:
Private Sub Preview_Click()
On Error GoTo Err_Preview_Click
Dim stDocName As String
stDocName = "RptFactSheet"
DoCmd.OpenReport "RptFactSheet", acPreview, , "[AddressID] = " & [AddressID]
Exit_Preview_Click:
Exit Sub
Err_Preview_Click:
MsgBox Err.Description
Resume Exit_Preview_Click
End Sub
I can not see what I am doing wrong here, any suggestions? Thank you in advance for any help.
Private Sub Preview_Click()
On Error GoTo Err_Preview_Click
Dim stDocName As String
stDocName = "RptFactSheet"
DoCmd.OpenReport "RptFactSheet", acPreview, , "[AddressID] = " & [AddressID]
Exit_Preview_Click:
Exit Sub
Err_Preview_Click:
MsgBox Err.Description
Resume Exit_Preview_Click
End Sub
I can not see what I am doing wrong here, any suggestions? Thank you in advance for any help.