G
Guest
Hi,
I have searched posts for error message problems and can't seem to find a
solution to my problem.
I have an unbound form that has combo boxes for form and report selections.
I have an unbound text box to enter job number to. I use the following code:
Private Sub ComboFormList_Click()
On Error GoTo Err_ComboFormList_Click
Dim stFormName As String
stFormName = Me.ComboFormList
If IsNull(JobNumber) Then
MsgBox ("Please enter job number before making selection")
Me.JobNumber.SetFocus
End If
DoCmd.OpenForm stFormName, , , "JobNumber=" & Me.JobNumber
Exit_ComboFormList_Click:
Exit Sub
Err_ComboFormList_Click:
MsgBox Err.Description
Resume Exit_ComboFormList_Click
End Sub
Everything works as I want except if user goes to form selection combo box
and tries to make a selection, they get error message in code and the focus
is set to JobNumber text box, AND THEN there is another error "Syntax error
(missing operator) in query expression 'JobNumber='."
If user puts job numberin the text box first, there is no error message. Is
there a way to stop the second error message? I'm not sure what I'm missing
here.
Any help is greatly appreciated!!
Thanks in advance!
Phisaw
I have searched posts for error message problems and can't seem to find a
solution to my problem.
I have an unbound form that has combo boxes for form and report selections.
I have an unbound text box to enter job number to. I use the following code:
Private Sub ComboFormList_Click()
On Error GoTo Err_ComboFormList_Click
Dim stFormName As String
stFormName = Me.ComboFormList
If IsNull(JobNumber) Then
MsgBox ("Please enter job number before making selection")
Me.JobNumber.SetFocus
End If
DoCmd.OpenForm stFormName, , , "JobNumber=" & Me.JobNumber
Exit_ComboFormList_Click:
Exit Sub
Err_ComboFormList_Click:
MsgBox Err.Description
Resume Exit_ComboFormList_Click
End Sub
Everything works as I want except if user goes to form selection combo box
and tries to make a selection, they get error message in code and the focus
is set to JobNumber text box, AND THEN there is another error "Syntax error
(missing operator) in query expression 'JobNumber='."
If user puts job numberin the text box first, there is no error message. Is
there a way to stop the second error message? I'm not sure what I'm missing
here.
Any help is greatly appreciated!!
Thanks in advance!
Phisaw