testdba
Registered User.
- Local time
- Today, 04:21
- Joined
- Dec 16, 2004
- Messages
- 26
I have a form named frmProducts and on it there is a field for the name of the product supplier. Beside the supplier there is a button named cmdViewSupplierDetails that is supposed to open a form with the specific supplier's details. Somewhere on this board I found an example of this (the example was called DemoDetailsA97.mdb), but I'm having trouble getting it to work. This is the code on the view button:
The error I get when I click the button is: "Syntax error (missing operator) in query expression '[SupplierName]=test manufacturer'. (Test manufacturer is what is in the combo box labled "SupplierName".)
What do I have wrong? In the example database, the two connected fields were number fields and I am using two text fields, does that make the difference in the query syntax?
Thanks for the help.
-Tim
Code:
Private Sub cmdViewSupplierDetails_Click()
On Error GoTo Err_cmdViewSupplierDetails_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmSuppliers"
If IsNull(Me!SupplierName) Then
MsgBox "Select a valid supplier."
Exit Sub
Else
stLinkCriteria = "[SupplierName]=" & Me![SupplierName]
End If
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdViewSupplierDetails_Click:
Exit Sub
Err_cmdViewSupplierDetails_Click:
MsgBox Err.Description
Resume Exit_cmdViewSupplierDetails_Click
End Sub
The error I get when I click the button is: "Syntax error (missing operator) in query expression '[SupplierName]=test manufacturer'. (Test manufacturer is what is in the combo box labled "SupplierName".)
What do I have wrong? In the example database, the two connected fields were number fields and I am using two text fields, does that make the difference in the query syntax?
Thanks for the help.
-Tim