Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to scan barcode and have it update existing table 1

Status
Not open for further replies.

Kerock

Instructor
Jun 16, 2000
13
0
0
US
Visit site
Can anyone help with this?<br><br>I have a table of UPC codes that have been scanned (inbound products). <br>&nbsp;<br>Table: Inventory<br>Fields: <b>[UPCcode],[DateIn],[DateOut]</b><br><br>I would like to scan the product again when it is shipped out and add a date (which uould be an update to and existing record).<br><br>Does anyone know a good way to do this (create a form)?&nbsp;&nbsp;I will be scanning mutiple items, and I don't want to have to hit ENTER after each scan.
 
Kerock,<br>Once you've read the serial port after a complete scan (this is a separate issue, I'm assuming you've got that part done), you'd have a variable that contains the barcode value.&nbsp;&nbsp;All you need to do now is run sql over the table:<br>docmd.runsql &quot;UPDATE Inventory set DateOut = date() where UPCcode = &quot;&quot;&quot; & variable & &quot;&quot;&quot;&quot;<br>This assumes that 'variablle' is a string...commonly you'd read the port in text mode, athough there is a 'binary' option.<br><br>The comm control can be on a form that isn't even visible, (but it must be open) and when the port sends the incoming characters, the comm reads them, and the query runs when you've decided (through code) that a complete, valid code has been received.<br>--Jim
 
Thanks Jim,<br><br>You suggestion works great, however, I still am trying to enter the scans <b><i>without</b></i> having to hit ENTER and answer OK to the UPDATE confirmation.&nbsp;&nbsp;&nbsp;Any ideas?&nbsp;&nbsp;&nbsp;(I have a SYMBOL scanner that is on a y-adapter with the keyboard via the PS/2 port and entering a fixed length barcode).
 
if you say:<br>docmd.setwarnings false<br><br>prior to the runsql, this disbles the prompt.&nbsp;&nbsp;Don't forget to reset:<br>docmd.setwarnings true<br><br>...afterwards--if you don't then a slippery finger could delete entire tables without any prompt whatsoever.<br>--Jim
 
Jim... one quick follow up question.&nbsp;&nbsp;Since I am new to SQL, could you explain how the quotations work in the statement <br><b>docmd.runsql &quot;UPDATE Inventory set DateOut = date() where UPCcode = &quot;&quot;&quot; & variable & &quot;&quot;&quot;&quot;<br></b>?<br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top