G
Guest
I am trying to open a form to a certain record based on criteria but I keep
getting a run-time error 75, syntax error. First of here is my code
Private Sub xTree_DblClick()
' Allow Users to Open the Form selected record.
Dim strKey As String
strKey = Me.xTree.SelectedItem
DoCmd.OpenForm "NewMaintenanceWorkOrder", , , ("[WOKeyInfo]=" &
strKey)
End Sub
Now the text it is receiving is like this..ie
(Work Order #1), (Problem) - Machine Crash
When it errors it says "Syntax error (missing operator) in query expression
'[WOKeyInfo]=(Work Order #1), (Problem) - Machine Crash'.
I thought maybe it was a problem reading the selecteditem, so I put an
unbound box in the form and set the xTree.Click() to set the value from the
selecteditem into the unbound box and the dblClick() to read from it ..ie
DoCmd.OpenForm "NewMaintenanceWorkOrder", , , ("[WOKeyInfo]=" & [Text1])
Same Error, but if I input the text directly into the code ..ie
DoCmd.OpenForm "NewMaintenanceWorkOrder", , , ("[WOKeyInfo]= '(Work Order
#1), (Problem) - Machine Crash)'")
it works. My Question is why, is it the parenthesis or the comma causing
the problem or is it a problem with my expression.
getting a run-time error 75, syntax error. First of here is my code
Private Sub xTree_DblClick()
' Allow Users to Open the Form selected record.
Dim strKey As String
strKey = Me.xTree.SelectedItem
DoCmd.OpenForm "NewMaintenanceWorkOrder", , , ("[WOKeyInfo]=" &
strKey)
End Sub
Now the text it is receiving is like this..ie
(Work Order #1), (Problem) - Machine Crash
When it errors it says "Syntax error (missing operator) in query expression
'[WOKeyInfo]=(Work Order #1), (Problem) - Machine Crash'.
I thought maybe it was a problem reading the selecteditem, so I put an
unbound box in the form and set the xTree.Click() to set the value from the
selecteditem into the unbound box and the dblClick() to read from it ..ie
DoCmd.OpenForm "NewMaintenanceWorkOrder", , , ("[WOKeyInfo]=" & [Text1])
Same Error, but if I input the text directly into the code ..ie
DoCmd.OpenForm "NewMaintenanceWorkOrder", , , ("[WOKeyInfo]= '(Work Order
#1), (Problem) - Machine Crash)'")
it works. My Question is why, is it the parenthesis or the comma causing
the problem or is it a problem with my expression.