473,569 Members | 2,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Losing Focus

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.

Feb 21 '07 #1
5 5258
LabGeek wrote:
A user will scan a barcode into a text box (linked to a table field)
<snip>
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?
If you're inputting two things at once, then you run the risk of the
problem you describe. What about not requerying the list box control
except as the after update event of the text box that receives the scan?
You may have to change your interface on the form so that the user
knows s/he should weigh the sample first and then scan the bar code.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Be Careful, Big Bird!" - Ditto "TIM-MAY!!" - Me
Feb 21 '07 #2
On Feb 21, 12:03 pm, Tim Marshall
<TIM...@PurpleP andaChasers.Moe rtheriumwrote:
LabGeek wrote:
A user will scan a barcode into a text box (linked to a table field)
<snip>
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?

If you're inputting two things at once, then you run the risk of the
problem you describe. What about not requerying the list box control
except as the after update event of the text box that receives the scan?
You may have to change your interface on the form so that the user
knows s/he should weigh the sample first and then scan the bar code.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Be Careful, Big Bird!" - Ditto "TIM-MAY!!" - Me
Tim,

Thanks for the reply. There are two users in this process. One is
scanning the barcode and taking another measurement which is being
"picked" off a list of barcodes adn the second person is weighting.
The way it is set up, both operators can run independantly of each
other as long as 1) there has been a barcode scanned in for the
record, and 2)they keep the samples in order. This way, person one
can scan multiple samples and be ahead of person two who is doing the
weighting. The scale sends the data to the record with the oldest
timestamp that doesn't have a weight and then updates the screen
(list). This was neither person has to wait for a sample to be
totally completed before starting the next one.

When things are timed just right I have no problems, but when the
people taking the measurements get just out of synch (or are operating
fast) then I get the chance of the list box running a query at the
same time the scaner is reading a bar code. When this happens, there
is the smallest window of time when the text box loses focus and we
lose some of the scanned barcode.

I have tried adding conditions such as "don't query if the text box <>
"" " but this seems to confuse people when the hear the scale beep but
the screen hasn't updated to show the weight has sucessfully taken.

Feb 21 '07 #3
is the listbox locked ? or disabled ? wouldn't that prevent it from
getting focus ?

how is the listbox updated ? a timer event ?
On Feb 21, 2:37 pm, "LabGeek" <tlbr...@monsan to.comwrote:
On Feb 21, 12:03 pm, Tim Marshall

<TIM...@PurpleP andaChasers.Moe rtheriumwrote:
LabGeek wrote:
A user will scan a barcode into a text box (linked to a table field)
<snip>
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?
If you're inputting two things at once, then you run the risk of the
problem you describe. What about not requerying the list box control
except as the after update event of the text box that receives the scan?
You may have to change your interface on the form so that the user
knows s/he should weigh the sample first and then scan the bar code.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Be Careful, Big Bird!" - Ditto "TIM-MAY!!" - Me

Tim,

Thanks for the reply. There are two users in this process. One is
scanning the barcode and taking another measurement which is being
"picked" off a list of barcodes adn the second person is weighting.
The way it is set up, both operators can run independantly of each
other as long as 1) there has been a barcode scanned in for the
record, and 2)they keep the samples in order. This way, person one
can scan multiple samples and be ahead of person two who is doing the
weighting. The scale sends the data to the record with the oldest
timestamp that doesn't have a weight and then updates the screen
(list). This was neither person has to wait for a sample to be
totally completed before starting the next one.

When things are timed just right I have no problems, but when the
people taking the measurements get just out of synch (or are operating
fast) then I get the chance of the list box running a query at the
same time the scaner is reading a bar code. When this happens, there
is the smallest window of time when the text box loses focus and we
lose some of the scanned barcode.

I have tried adding conditions such as "don't query if the text box <>
"" " but this seems to confuse people when the hear the scale beep but
the screen hasn't updated to show the weight has sucessfully taken.- Hide quoted text -

- Show quoted text -

Feb 21 '07 #4
On Feb 21, 4:05 pm, lesperan...@nat pro.com wrote:
is the listbox locked ? or disabled ? wouldn't that prevent it from
getting focus ?

how is the listbox updated ? a timer event ?

On Feb 21, 2:37 pm, "LabGeek" <tlbr...@monsan to.comwrote:
On Feb 21, 12:03 pm, Tim Marshall
<TIM...@PurpleP andaChasers.Moe rtheriumwrote:
LabGeek wrote:
A user will scan a barcode into a text box (linked to a table field)
<snip>
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?
If you're inputting two things at once, then you run the risk of the
problem you describe. What about not requerying the list box control
except as the after update event of the text box that receives the scan?
You may have to change your interface on the form so that the user
knows s/he should weigh the sample first and then scan the bar code.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Be Careful, Big Bird!" - Ditto "TIM-MAY!!" - Me
Tim,
Thanks for the reply. There are two users in this process. One is
scanning the barcode and taking another measurement which is being
"picked" off a list of barcodes adn the second person is weighting.
The way it is set up, both operators can run independantly of each
other as long as 1) there has been a barcode scanned in for the
record, and 2)they keep the samples in order. This way, person one
can scan multiple samples and be ahead of person two who is doing the
weighting. The scale sends the data to the record with the oldest
timestamp that doesn't have a weight and then updates the screen
(list). This was neither person has to wait for a sample to be
totally completed before starting the next one.
When things are timed just right I have no problems, but when the
people taking the measurements get just out of synch (or are operating
fast) then I get the chance of the list box running a query at the
same time the scaner is reading a bar code. When this happens, there
is the smallest window of time when the text box loses focus and we
lose some of the scanned barcode.
I have tried adding conditions such as "don't query if the text box <>
"" " but this seems to confuse people when the hear the scale beep but
the screen hasn't updated to show the weight has sucessfully taken.- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -
There are 5 basic contols on the form. 2 bound text boxes for
scanning in a barcode and a measurement, a text box for displaying
data from a scale, a graph for creating time course representation and
a list box to display all the data that will fit (this is so the users
can monitor the previous several records. The list box and graph are
fed from querys that are run each time there is a Form_update event.
The text boxes are not locked to allow data to be scanned directly
into them. The weight values that are shown on the screen are read
from the table after the com event records them from the scale.

Each time the scale records data, I must requery the table to place
the weight on the screen to "prove" to the user that the value has
been recorded. Sometimes during that query, a second user will scan a
barcode into the unlocked, bound text box (which creates a new record)
and there is a short interval that the text box loses focus and drops
characters.

Thank for the reply!

Feb 21 '07 #5
Are you sure that the textbox has lost focus... or is Access still
processing the form's
after_update() event ?

what happens if you move the requerying of the list box from the
after_update() event to the timer() event ?

are the listbox and graph controls enabled ? is so, why can't they be
disabled so that they can't get focus ?
On Feb 21, 3:49 pm, "LabGeek" <tlbr...@monsan to.comwrote:
On Feb 21, 4:05 pm, lesperan...@nat pro.com wrote:


is the listbox locked ? or disabled ? wouldn't that prevent it from
getting focus ?
how is the listbox updated ? a timer event ?
On Feb 21, 2:37 pm, "LabGeek" <tlbr...@monsan to.comwrote:
On Feb 21, 12:03 pm, Tim Marshall
<TIM...@PurpleP andaChasers.Moe rtheriumwrote:
LabGeek wrote:
A user will scan a barcode into a text box (linked to a table field)
<snip>
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?
If you're inputting two things at once, then you run the risk of the
problem you describe. What about not requerying the list box control
except as the after update event of the text box that receives the scan?
You may have to change your interface on the form so that the user
knows s/he should weigh the sample first and then scan the bar code.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Be Careful, Big Bird!" - Ditto "TIM-MAY!!" - Me
Tim,
Thanks for the reply. There are two users in this process. One is
scanning the barcode and taking another measurement which is being
"picked" off a list of barcodes adn the second person is weighting.
The way it is set up, both operators can run independantly of each
other as long as 1) there has been a barcode scanned in for the
record, and 2)they keep the samples in order. This way, person one
can scan multiple samples and be ahead of person two who is doing the
weighting. The scale sends the data to the record with the oldest
timestamp that doesn't have a weight and then updates the screen
(list). This was neither person has to wait for a sample to be
totally completed before starting the next one.
When things are timed just right I have no problems, but when the
people taking the measurements get just out of synch (or are operating
fast) then I get the chance of the list box running a query at the
same time the scaner is reading a bar code. When this happens, there
is the smallest window of time when the text box loses focus and we
lose some of the scanned barcode.
I have tried adding conditions such as "don't query if the text box <>
"" " but this seems to confuse people when the hear the scale beep but
the screen hasn't updated to show the weight has sucessfully taken.- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -

There are 5 basic contols on the form. 2 bound text boxes for
scanning in a barcode and a measurement, a text box for displaying
data from a scale, a graph for creating time course representation and
a list box to display all the data that will fit (this is so the users
can monitor the previous several records. The list box and graph are
fed from querys that are run each time there is a Form_update event.
The text boxes are not locked to allow data to be scanned directly
into them. The weight values that are shown on the screen are read
from the table after the com event records them from the scale.

Each time the scale records data, I must requery the table to place
the weight on the screen to "prove" to the user that the value has
been recorded. Sometimes during that query, a second user will scan a
barcode into the unlocked, bound text box (which creates a new record)
and there is a short interval that the text box loses focus and drops
characters.

Thank for the reply!- Hide quoted text -

- Show quoted text -

Feb 22 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
5005
by: Morten Wennevik | last post by:
I'm pretty sure this has been mentioned a few times, but so far I haven't found anything. I am trying to "lock" a program to always focus, non closable etc, but overriding OnDeactivate and calling Activate() only works 1 time, and never again. After the initial refocus it never seems to fire. What else needs to be done? Is it possible to...
86
3537
by: Michael Adams | last post by:
I don't know if you have noticed, but it seems like Microsoft is losing interest in C#, and putting their energy into Visual Basic.NET instead. For instance, online chats by language since July 1, 2004: VB.NET 47 C# 6 C++ 8 J# 0
1
1482
by: DomGo | last post by:
Hi, I try to open a form, that automatically loses focus to the window, that had the focus immediatly before the new form has been opened. The new form is topmost and displays a message only for a certain time, while the user can work on his current window. Everthing works except the fact, that the opened form gets the focus. I tried to...
0
1488
by: Stefan De Schepper | last post by:
Dear NG, I created a gridlike usercontrol. When clicking on a cell a textbox (or other control, depending on the cell's editortype) is shown. When some other control gets the focus, the textbox is hidden. So far, no problem. But when the textbox is visible and, for instance, I click on a toolbarbutton, the textbox' Lostfocus event is not...
3
2339
by: Chris | last post by:
I have a form that calls ShowDialog on a number of different forms at different times. I want to be able to know anytime the form loses focus. But Form.Focused isn't ever true once a control has focus and Form.Leave does not fire when showdialog is called on another form. Anyone have any idea how to capture the form losing focus? Chris
1
2274
by: Israel | last post by:
The problem: I want to know, definitively when a slider loses focus after a user has started sliding and hasn't released the mouse yet. It appears that this is captured with the WM_ACTIVATEAPP message but this only goes to the form and I want it in the user control that maybe very much removed from the form's knowledge; i.e. the form may...
3
5401
by: Patrick [MSFT] | last post by:
Let me preface this with the goal I'm trying to achieve is mimic a feature of another language (Dexterity used by Microsoft Dynamics) and so while a filling a drop down list is a workable solution I'd rather do it like Microsoft Dynamics does and use separate textbox and lookup button. What I have is, simply, is a C# winform, a textbox and a...
0
1127
by: euthymos | last post by:
Dear developers, I'm developing an application which uses MSWord Interop interface. When my application launches MSWord, my application itself loses the focus (even if MSWord is not visible). Is there any way to prevent this from happening, or to give the focus back to my application? Running Me.Focus() does not work at all, even if I...
25
5146
bugboy
by: bugboy | last post by:
I'm trying to find a cross browser solution for editing text in a flickr photo caption manor where the text is displayed in a <div> or <a> tag but changes to a <textarea> via JS when clicked. There are two problems. 1. setting the focus on the new textarea 2. keeping the new text value when switching back to normal text. Firefox: focuses...
0
7609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7921
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7666
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.