joesstlouis
Registered User.
- Local time
- Today, 08:00
- Joined
- Feb 20, 2006
- Messages
- 10
I'm currently trying to get a button working that will check the contents of a field for a value, and if nothing is selected I want it to prompt the user to select something. Here's my code:
Private Sub Command47_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmCustomerInf"
stLinkCriteria = "[CustomerID]=" & Me![CustomerID]
If [CustomerID] = "" Then
MsgBox "Please Select a Company Name", vbInformation, "Warning"
Else
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
End Sub
For some reason I can't get this working, what am I doing wrong?
The error I'm getting when trying the button is Run-time error 3075: Syntax Error (Missing operator) in query expression '[CustomerID]='
Private Sub Command47_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmCustomerInf"
stLinkCriteria = "[CustomerID]=" & Me![CustomerID]
If [CustomerID] = "" Then
MsgBox "Please Select a Company Name", vbInformation, "Warning"
Else
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
End Sub
For some reason I can't get this working, what am I doing wrong?
The error I'm getting when trying the button is Run-time error 3075: Syntax Error (Missing operator) in query expression '[CustomerID]='
Last edited: