ScrmingWhisprs
I <3 Coffee Milk.
- Local time
- Yesterday, 20:08
- Joined
- Jun 29, 2006
- Messages
- 156
Hi there. I have a volunteer sign in form that has an unbound textbox (txtBarcode) and a Command Button (cmdSignIn). Our workers have ID badges with barcodes that are linked to their records. When a worker scans his/her barcode, the command button should do the following:
However, I get an INSERT INTO syntax error. Can you see what's wrong with this?
Thanks.
SW
Code:
Private Sub cmdSignIn_Click()
'Using these declarations, I should be able to return the worker's ID number.
Dim Barcode As String
Dim WorkerNumber As Integer
Dim TodaysDate As String
Barcode = Me.txtBarcode
WorkerNumber = DLookup("vID", "tblVolunteers", "[Barcode]='" & Barcode & "'")
TransactionDate = Me.Date
'This INSERT INTO statement should insert a new record into tblTransactions with the Worker's ID number that was retrieved above, the transaction date, and the value "1" for the DateType
DoCmd.RunSQL ("INSERT INTO tblTransactions (WorkerID,Date,DateType)" & _
"VALUES (WorkerNumber,TransactionDate,1)")
End Sub
However, I get an INSERT INTO syntax error. Can you see what's wrong with this?
Thanks.
SW