Hi. I'm using Access 2007. Have a project with several forms and reports, all work fine except the latest one I'm working on.
I'm using the following code on many buttons in different forms to print specific reports:
Dim strWhere As String
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[ID] = " & Me.[ID]
DoCmd.OpenReport "Label Ruta Unit", acViewPreview, , strWhere
End If
End Sub
And they all work fine except for the last form I'm working on. This one gives me "Error 2465, Unable to find the field "|" referred to in your expression."
When I debug, it highlights this part of the code:
strWhere = "[ID] = " & Me.[ID]
Also should mention I'm pretty much self taught and a beginner when it comes to Access. So please be gentle. lol.
Any help is greatly appreciated.