Queries

Surjer

Registered User.
Local time
Today, 06:54
Joined
Sep 17, 2001
Messages
232
Hey Guys & Ladies....

I can't seem to get this querie to run correctly. I've placed it on a form and when the Variable = a number it works fine but when the variable = text it pops up an error saying (Missing Operator) in query expression, do you wish to ...........

Any help would be greatly appreciated.
Private Sub in_Click()
Me.out = False
End Sub
Private Sub out_Click()
Dim TN As String
Dim ET As String
Dim SN As String
SN = Me.Serial_Number
ET = Me.Equipment_Type
TN = Me.Tag_Number.Value
''''''''''''''
Me.In = False
''''''''''''''
DoCmd.RunSQL ("INSERT INTO Events ( Date_Out )SELECT Now() AS Expr1;")
DoCmd.RunSQL ("UPDATE Events SET Events.Tag_Number = " & " " & TN & " " & "WHERE (((Events.Date_Out)=Now()));")
DoCmd.RunSQL ("UPDATE Events SET Events.Equipment_Type = " & " " & ET & " " & "WHERE (((Events.Date_Out)=Now()));")
DoCmd.RunSQL ("UPDATE Events SET Events.Serial_Number = " & " " & SN & " " & "WHERE (((Events.Date_Out)=Now()));")

End Sub
 
Never mind I got it"

The Variables need to be enclosed in " " marks

In this case I just used & Chr(39) TN & Chr(39)
 
Why not combine the 4 queries into a single insert query with multiple columns?
 

Users who are viewing this thread

Back
Top Bottom