MS Access - looking for help with some 'under the hood' coding.

Copper Contributor

I have developed a chromebook inventory database.  What I would like to do is 'check in' chromebooks that have been returned by using a barcode scanner.


I have a table that has the asset tag, other info, and a y/n check in box and a date field for CheckInDate


What I would like to have happen is to click a button on my main menu that opens this check in form, the form (or currently underlying query) request the chomebook asset # be entered in the pop-up window.  The barcode is scanned, the value enters in the pop-upbox, and the info attached to that chromebook asset tag is returned.  This all works well currently.


Here's where I'm having trouble.  Updating (via SQL, VBA, Update query) the yes/no field to Yes and the CheckinDate field with the current date, closing the record, and opening the form again triggering the pop-up box again to scan the next chromebook all without touching the keyboard.


I'm having trouble identifying the best method for doing that and the syntax to do so. 


I was trying 'after update' event option of the CBTAG field to run a macro or update query with - no luck.


Any thoughts?  syntax suggestions?



1 Reply
Hello Gregory,

I could think of a solution with the (VBA) timer-event of the pop-up form that checks if a scan occurred. I would set the timer to fire every x milliseconds and within (the VBA) Form_Timer subroutine I would execute the following 'actions':

1. Check with an If-statement if the asset # is filled (by the barcode scanner).
2. If asset # is filled, run a query with DoCmd.RunSQL to UPDATE the yes/no field and the Checkindate.
3 Empty the asset # field (with something like Me.txtAssetNo = ""); reset the tag-info if needed.

This way the pop-up stays open, waiting for the next scan. And if that happens, the timer-event processes the next scan. No keyboard or mouse action needed.

Hope this helps.

Best regards,