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!
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
When an item is scanned, check to see if matches the 'Add Record' barcode. If it does, don't record the value in the cell...jump straight to the add record routine.
 
Upvote 0
When an item is scanned, check to see if matches the 'Add Record' barcode. If it does, don't record the value in the cell...jump straight to the add record routine.
Thank you for the reply, Im not sure what you mean, I dont have an Add Record barcode, that is what I am wanting help with.
 
Upvote 0
Create a barcode using the ‘barcode’ font with a value of 9999999. Or some unique number. Then when any barcode is scanned, if it equals that value then trigger the add record sub.
 
Upvote 0
Create a barcode using the ‘barcode’ font with a value of 9999999. Or some unique number. Then when any barcode is scanned, if it equals that value then trigger the add record sub.
Sorry to bother, but are you saying to use something like an IIF statement?
 
Upvote 0
Difficult to provide direction without your current code...but when you scan a barcode, it will return a number..so you'll do something like:

VBA Code:
If scan.value = "99999999" then AddRecord
 
Last edited by a moderator:
Upvote 0
Difficult to provide direction without your current code...but when you scan a barcode, it will return a number..so you'll do something like:

VBA Code:
If scan.value = "99999999" then AddRecord
I dont currently have code, I am trying to do this in an access form, basically what I want to happen is: if 999999 is entered into any of the fields labeled item1, item2, item3, item4, item5, then i want it to automatically add the record.

1720019277416.png
 
Last edited by a moderator:
Upvote 0
When you say you want to "add record" what does that mean? Do you want to copy the values to another sheet? Other?

For your code you'll be looking at something like (assuming your values are being entered into range B1:B9:

VBA Code:
Private Sub worksheet_change(ByVal target As Range)
If Not Intersect(target, Range("B1:B9")) Is Nothing Then
    If target.Value = "99999999" Then
        'do something here to add record
    End If
End If
End Sub
 
Upvote 0
When you say you want to "add record" what does that mean? Do you want to copy the values to another sheet? Other?

For your code you'll be looking at something like (assuming your values are being entered into range B1:B9:

VBA Code:
Private Sub worksheet_change(ByVal target As Range)
If Not Intersect(target, Range("B1:B9")) Is Nothing Then
    If target.Value = "99999999" Then
        'do something here to add record
    End If
End If
End Sub
I want it to add the record and be ready to enter data into a new record. What happens with this is, an employee goes to our supply room for supplies, they may only need gloves for example, so after the clerk scans the barcode for gloves, the cursor goes to the next line, so at that point, i would like for them to scan the "Add Record" barcode to enter that record into the table and be ready for the next employee, if they get gloves, boots and a hardhat, after they scan those 3, the cursor will then be in Item 4 box, they would scan the Add Record barcode to enter that record and be ready for the next, I hope that makes sense. I understand I will have to put that code into each of the Item text boxes, but I am fine with that, Also, this in in Access, not Excel.
 
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