Use barcode to trigger event on Form

JoeyGaspard

Board Regular
Joined
Jul 22, 2019
Messages
164
I have created an access form that uses a barcode scanner to enter data for employee supplies, they can scan up to 5 supplies per employee. What I would like to do is after they have scanned all they are issuing to the employee, to be able to scan a barcode that emulates clicking the Add Record button. I am trying to do this process with no keyboard/mouse input. Everything works perfectly if they scan 5 items to every employee because the scanner tabs after the scan, but if they only scan 2 items, I need them to be able to scan a barcode to add that record in preparation for the next employee. I hope this makes sense, and thank you in advance!
 
Then where I have
'do something here to add record

You'll put your code in there to copy the range to the bottom of your table, wherever that may be.
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Ah, MS Access...I see now...I'm not familiar with the syntax of MS Access; however the logic should be similar.
 
Upvote 0
If your database was properly normalised, you would not need that, as each item would already be a record?
So your incorrect structure is causing you this issue.
 
Upvote 0
If your database was properly normalised, you would not need that, as each item would already be a record?
So your incorrect structure is causing you this issue.
I guess I dont understand what you mean? Are yu saying that every field in the form would be written to the table as its own record?
 
Upvote 0
Every item in supplies would be written as a separate record.
What happens when they are allowed 10 items?, then you have to change your form? :(

GUI would likely be a mainform for the employee and a subform for their supplies.
 
Upvote 0
Good to hear you got the solution.
If you would like to post the solution then it is perfectly fine to mark your post as the solution to help future readers. Otherwise, please do not mark a post that doesn't contain a solution.
 
Upvote 0
Good to hear you got the solution.
If you would like to post the solution then it is perfectly fine to mark your post as the solution to help future readers. Otherwise, please do not mark a post that doesn't contain a solution.
This is the code used to resolve the problem.


VBA Code:
Private Sub Item2_AfterUpdate()
With Me
If Item2.Value = 9999 Then
DoCmd.GoToRecord , , acNewRec
Me.EmployeeID.SetFocus
End If
End With

End Sub
 
Last edited by a moderator:
Upvote 0
Solution
So what if you have two barcodes or more, and the 3rd, 4th or 5th have the 999 value?
You have to repeat that code in each of those?
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,109
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top