Textbox input to multiple fields. (1 Viewer)

Tourless

New member
Local time
Today, 09:51
Joined
Oct 6, 2023
Messages
8
Hi Folks.

I feel like this should be that difficult but for the life of me I can't figure out how to take the value entered into a form's textbox via a barcode scanner and place it into more than one field in a single table. I've tried a variety of events... BeforeUpdate, AfterUpdate, KeyPress, Enter, I've tried using event procedures and queries but nothing seems to works. My ultimate goal is to scan a barcode, have it entered into one field, and then entered into another field but truncating the value by removing the last two characters of the input. It shouldn't be that complicated...
A barcode is scanned into a text field on a form that is bound to a field in my table... the barcode scanner is programmed to scan then send an enter event which is used by Access to perform a 'nextrecord' function. I'm attaching my working version to this post in hope somebody who knows a bit more than I will take a look and say 'oh, here, this is you're problem...' Any help or direction is greatly appreciated. - thank you.
 

Attachments

  • Packout Tracker.accdb
    3.9 MB · Views: 64

GPGeorge

Grover Park George
Local time
Today, 06:51
Joined
Nov 25, 2004
Messages
1,872
Please clarify. In the sample data, the same string of numbers appears in each record in the Barcode field: 230179680501

I assume that's an artifact of testing, and that in production the Barcodes will not be duplicated?

What you want is to place all but the final two characters, i.e."01", in the field called LMBarCode.

Correct?

Will all of the Barcodes be the same number of characters?
 

Tourless

New member
Local time
Today, 09:51
Joined
Oct 6, 2023
Messages
8
Please clarify. In the sample data, the same string of numbers appears in each record in the Barcode field: 230179680501

I assume that's an artifact of testing, and that in production the Barcodes will not be duplicated?

What you want is to place all but the final two characters, i.e."01", in the field called LMBarCode.

Correct?

Will all of the Barcodes be the same number of characters?
Yes sir, you are correct. The existing entries in tblPackout!Barcode just tests, me trying to get a value into LMBarcode, there will be no duplications allowed in the production db. The barcodes will always be a total of 12 numeric characters.
 

Gasman

Enthusiastic Amateur
Local time
Today, 14:51
Joined
Sep 21, 2011
Messages
14,306
I would not store it twice.
 

Mike Krailo

Well-known member
Local time
Today, 09:51
Joined
Mar 28, 2020
Messages
1,044
Seems like a convoluted requirement. Why not put the scaned data into the bound field and put the code to truncate last two characters in the forms before update. You should not store that value more than once.
 

Mike Krailo

Well-known member
Local time
Today, 09:51
Joined
Mar 28, 2020
Messages
1,044
the barcode scanner is programmed to scan then send an enter event which is used by Access to perform a 'nextrecord' function
Have you tried to set the field size to twelve in the table directly? That might do the truncation for you automatically.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:51
Joined
Feb 19, 2002
Messages
43,275
but nothing seems to works
That's because you haven't tried the correct event yet. The control level events are NOT raised when the control is modified by VBA which is what is happening when you scan it. The control level events only fire when the control gets the focus. However, the form level events revolving around dirty records do fire because the scanner dirtied the record. Therefore, add your code to the FORM's BeforeUpdate event.

But, as the others pointed out, you probably don't want to store the barcode twice.
 

Users who are viewing this thread

Top Bottom