Losing Focus

L

LabGeek

I have an Access application that I have created that collects data
from a scanner and from a weighting scale. The data from the scanner
are unique identifiers (barcodes) and the scanner is connected as a
keyboard wedge. The data from the scale are weights and are collected
by com port using MScomm32.ocx.

A user will scan a barcode into a text box (linked to a table field)
and then weight a sample. The weight will be collected from the com
port and directly updated to the table. To insure the user that the
weight was successfully captured, I have included a listbox which
queries the table after each scale recording. This way the user can
see their data show up on the screen in a mock spreadsheet.

My problem is that about 1 in 100 barcode scans do not completely
read. I have traced this error to the requerying of the listbox
control. If a barcode is being read in at the same time as the
listbox is being updated, there is a slight chance of the text box (in
which the barcode is being entered) losing focus for a split second.
Since the computer sees the scanner as a keyboard wedge, it sends the
data to whatever has focus. When the text box loses focus, I lose
part of the barcode.

Is there a way to maintain focus on the text box no matter what
background processes are running? Or better yet is there a better way
to run a query that doesn't take focus away from foreground processes?

Thanks.
 
G

Guest

Hi LabGeek,

I guess you could always have it requery after each barcode scan instead...
I guess it depends on what else is happening in your system (ie: what
processing is happening and on what events).

An alternative would be to have your listbox set to value list, and instead
of requerying it, simply add the item to the listbox, ie:
me.LISTBOXNAME.additem (ITEM_DETAILS)

Hope this helps.

Damian.
 
L

LabGeek

Hi LabGeek,

I guess you could always have it requery after each barcode scan instead...
I guess it depends on what else is happening in your system (ie: what
processing is happening and on what events).

An alternative would be to have your listbox set to value list, and instead
of requerying it, simply add the item to the listbox, ie:
me.LISTBOXNAME.additem (ITEM_DETAILS)

Hope this helps.

Damian.









- Show quoted text -

Thanks for the reply Damian,

Adding my info to a text box would save me the individual requerying
and is worth some thought. The other major control I have on the form
(which I didn't mention) is a graph which displays the values. It
also is requeryed after every weight. I have changed this to only
requery after every 5 records, and it seems to help some.

The nice thing about having the list box show a query result vs. list
items is that it is makes it easier to change records and update the
graph and list box.

Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top