Good evening,
I am working on my inventory tracking system that keeps a record of items removed from the inventory by scanning a bar code with a scanner that automatically sends a carriage return after a scan (hits enter). So I am using the "on Enter" event to write my code.
I would like to simply use the SQL "INSERT INTO" statement. I am usinf an unbound text box as input. Here is what I have so far:
Code:
Private Sub scanTextBox_Enter()
Dim StrSQL As String
Dim scannedCode As String
scannedCode = scanTextBox.Value
StrSQL = "INSERT INTO [Current Sales] ([Purchase Date], [Purchase Time], [Product Code]) VALUES (Date(), Time(), scannedText)"
DoCmd.SetWarnings False
DoCmd.RunSQL (StrSQL)
scanTextBox.Value = ""
DoCmd.SetWarnings True
End Sub
Any advice?