After Update Event (1 Viewer)

kitty77

Registered User.
Local time
Today, 04:40
Joined
May 27, 2019
Messages
712
I have a form for data entry. I use a barcode scanner that simply enters a value into that field. I have some code on the after update the moves it to the next record.
My barcode scanner comes with the "enter" after each entry. Problem is I have that disabled for other software/s that I use the barcode scanner. So, when I disable the "enter" my form does not advance to the next record without physically hitting the enter key.

So, is there a better event other than after update or another way? Rather than changing my barcode scanner.

Thanks.
 

Ranman256

Well-known member
Local time
Today, 04:40
Joined
Apr 9, 2015
Messages
4,337
nope. afterupdate is best.
my guys scan, then press enter.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:40
Joined
Oct 29, 2018
Messages
21,467
Just as a test, try the Change event.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 03:40
Joined
Feb 28, 2001
Messages
27,156
The basic problem is that Access and Windows are essentially event-driven code. Oh, sure, you can run a program that will continue execution for minutes, hours, or days. But it was started by an event. EVERY VBA ACTION in Access is triggered by an event. Some events are obvious. Some are more subtle. But every event has the potential to have an effect via associated event routines. When you take away event triggers, you eliminate many opportunities to DO something.

Let's get to the specifics: You have this barcode scanner. It gives you barcodes as inputs. How do you know that it has finished giving you a barcode? (This is not a trick question.) Asked another way, your barcode scanner gives you a string of bytes. What tells you that you have a complete barcode input? Normally, the ENTER key is given special meaning to trigger an event, but if you suppress the key, how do you identify that your input can finally be used?

Without knowing the specifics of the barcode scanner interaction, it would be hard to say what would tell you this information. Is it something you open like a file using a VBA "OPEN <device> AS FILE <n> FOR INPUT" or does it use something else? If it is the file system, implicitly or explicitly, you are going to have to allow an event, because implicit in USING the file system is the understanding that your inputs will conform to file system rules. What is worse is that unlike some methods, you can't get inside the code of the file system very easily if at all.

EDIT: I see that theDBguy suggests the CHANGE event - but that will only work if your input goes directly to a form control. If you are using the file system (as noted above), there is no "change" event for the record; you only receive the input when the file system thinks the record is finished - which normally is via the enter key.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:40
Joined
Feb 19, 2002
Messages
43,257
The Change event runs for each character typed so, I don't know how it will help you. I suppose, if the barcodes are fixed in length, you can assume that the 12th (or whatever) character is the last character and force the tab/enter.

Why did you turn off the "enter" for the other software? I've never turned off "enter" when using a scanner. I always want to know when t is done.
 

Users who are viewing this thread

Top Bottom