Full Version: Runtime error 3075
UtterAccess Forums > Microsoft® Access > Access Forms
learner
I have a form which allow users to search for an order number, then click on a button to mark it so that the flag in the corresponding table will be updated. It works ok with most of my users (about 10) except 2, one of them gets the following error message whenever the button is clicked, the other sometimes gets the message and sometimes works fine. The rest of the users have never experienced any problem. They all have same environment, XP running Access 97. What does the error mean? Why does it only happens to some of the users not all, is it machine setting/hardware related?
un-time error '3075'
Syntax error (missing operator) in query expression "[OrderID]='.
When I click on Debug, the following code is being highlighted:
db.Execute "UPDATE LabelStatus SET LabelStatus.LabelReprintCurrent = 1" & _
" WHERE [OrderID] = " & Me.OrderNum
The complete code for that button is:
Private Sub MarkRBtn_Click()
Dim db AS DATABASE
Dim currLabel, currRLabel As Integer
Set db = CurrentDb()
currLabel = Me.NewLabelFlag
currRLabel - Me.ReprintLabelFlag
If currLabel = 0 And currRLabel = 0 Then
db.Execute "UPDATE LabelStatus SET LabelStatus.LabelReprintCurrent = 1" & _
" WHERE [OrderID] = " & Me.OrderNum
WriteLabelLogUpdate Me![OrderNum], currRLabel, "MR"
Call DoLookup
Else
MsgBox "This label cannot be reprinted."
End If
End Sub
Thanks in advance for any help and suggestions.
vtd
Could the user somehow activate the code when Me.OrderID is Null?
If this happens, Access will certainly error out with error no 3075.
For safe-coding, you should always check for Null in cases similar to this. You can even use Nz() function to returns zero (assuming RecordID is never zero) so that your SQL String does error out when executed.
learner
Thanks. I'll investigate further along this line.
vtd
You're welcome ... Hope it works out for you ...
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.