I have a command button on a Customer form that when clicked should open the Correspondence form and only show records belonging to that customer.
Code:
Private Sub btnCorrespondence_Click()
DoCmd.OpenForm "sfCorrespondence", , , "=[CustomerID] = " & Me!ID
End Sub
I get an error "An expression you entered is the wrong data type for one of the arguments" (runtime error 2498)
1. On the Customer form I have a command button with Event On Click set to Event Procedure, and links to the above code.
2. The Customer table, ID is AutoNumber (type = Long Integer)
3. The Correspondence table, CustomerID is Number (type = Long Integer)
What am I doing wrong here? I have played around with expressions and force typing variables but nothing works.
Using Windows 7 & MS Access 2010 (64 bit)