Tab Control and Keypress Events 
Author Message
 Tab Control and Keypress Events

Hi,

I am Working on an app that scans barcodes in A97.
(I haven't yet purchased the slot scanner)
A form with tabs.
Theory is, on one tab, the barcode is scanned, (a number - MemberID)
Then find the record that matches the ID.

For now I am simulating what the scanner willl do.
The keypress events are gathered and the record is found.
All controls are 'locked' and 'enabled' is set to false
Nothing can recieve the focus but the Tab Control
Seems to work OK when the form is first loaded
The TabCtl - "Page0" is the "Screen.ActiveControl"

PROBLEM:
When the tabs are clicked more than once or tabbed to, and they actually
recieve the focus, no keypress events are triggered.
Then the "TabCtl1" is the "Screen.ActiveControl"
My code is on the form's keypress event.
Although the tab control has a keypress event, any code placed there doesn't
seem to fire when keys are pressed. (The tab pages do NOT have key press
events)

Any help would be appreciated,
(or let me know if I'm not on track here)
Keith Bennett

Form code goes like this...
Private Sub Form_KeyPress(KeyAscii As Integer)
'********************************************************************
'Gather numeric keystokes, then after the return key, find the record
'
'********************************************************************
On Error GoTo Err_Form_KeyPress_Err
Static strKeys As String
Dim strCharacter As String

    Select Case KeyAscii
    Case 48 To 57 ' vbKey0 to vbKey9, KeyAscii 48 to 57 (numeric)
        strCharacter = Chr(KeyAscii)
        strKeys = strKeys & strCharacter

    Case vbKeyReturn
        If Not Len(strKeys) = 0 Then
            Me.RecordsetClone.FindFirst "tblMembers.MemberID = " & strKeys
                If Not Me.RecordsetClone.NoMatch = True Then
                    Me.Bookmark = Me.RecordsetClone.Bookmark
                Else ' No Match Found
                    MsgBox "Unable to find a MemberID matching " & strKeys
                End If
                strKeys = vbNullString

        End If

    End Select



Wed, 18 Jun 1902 08:00:00 GMT  
 Tab Control and Keypress Events
On a TabControl, when you move from one page to another, using any means, the On Change event
for the TabControl fires.  I've never found a use for the On Click event for the Tab Control!
The barcode scanner usually inputs data just like a keyboard does, into a text box.  At the end
of a successful barcode scan, a configurable code is received - usually either a cr lf (Enter
key) or a Tab key.  There is therefore no need to gather the separate key presses, just regard
the input as being typed into a text box followed by Enter or Tab.  Should be eezee-peezee!

Hth

Hugh

Quote:

> Hi,

> I am Working on an app that scans barcodes in A97.
> (I haven't yet purchased the slot scanner)
> A form with tabs.
> Theory is, on one tab, the barcode is scanned, (a number - MemberID)
> Then find the record that matches the ID.

> For now I am simulating what the scanner willl do.
> The keypress events are gathered and the record is found.
> All controls are 'locked' and 'enabled' is set to false
> Nothing can recieve the focus but the Tab Control
> Seems to work OK when the form is first loaded
> The TabCtl - "Page0" is the "Screen.ActiveControl"

> PROBLEM:
> When the tabs are clicked more than once or tabbed to, and they actually
> recieve the focus, no keypress events are triggered.
> Then the "TabCtl1" is the "Screen.ActiveControl"
> My code is on the form's keypress event.
> Although the tab control has a keypress event, any code placed there doesn't
> seem to fire when keys are pressed. (The tab pages do NOT have key press
> events)

> Any help would be appreciated,
> (or let me know if I'm not on track here)
> Keith Bennett

> Form code goes like this...
> Private Sub Form_KeyPress(KeyAscii As Integer)
> '********************************************************************
> 'Gather numeric keystokes, then after the return key, find the record
> '
> '********************************************************************
> On Error GoTo Err_Form_KeyPress_Err
> Static strKeys As String
> Dim strCharacter As String

>     Select Case KeyAscii
>     Case 48 To 57 ' vbKey0 to vbKey9, KeyAscii 48 to 57 (numeric)
>         strCharacter = Chr(KeyAscii)
>         strKeys = strKeys & strCharacter

>     Case vbKeyReturn
>         If Not Len(strKeys) = 0 Then
>             Me.RecordsetClone.FindFirst "tblMembers.MemberID = " & strKeys
>                 If Not Me.RecordsetClone.NoMatch = True Then
>                     Me.Bookmark = Me.RecordsetClone.Bookmark
>                 Else ' No Match Found
>                     MsgBox "Unable to find a MemberID matching " & strKeys
>                 End If
>                 strKeys = vbNullString

>         End If

>     End Select



Wed, 18 Jun 1902 08:00:00 GMT  
 Tab Control and Keypress Events
Hi, Hugh

Yes, I was trying to accomplish this keyboard (barcode) input without a text
box. That is why the code was on the form's keypress event, and I was
snagging keystrokes. I suppose I could use a text box, I just preferred not
to for appearance.
My question was probably more like can the tab control be prevented from
receiving the focus, then the form's keypress events would be fired
consistently and I wouldn't need a text box. (I'm new to barcoding)

Thanks,
Keith


Quote:
> On a TabControl, when you move from one page to another, using any means,
the On Change event
> for the TabControl fires.  I've never found a use for the On Click event

for the Tab Control!
Quote:
> The barcode scanner usually inputs data just like a keyboard does, into a

text box.  At the end
Quote:
> of a successful barcode scan, a configurable code is received - usually

either a cr lf (Enter
Quote:
> key) or a Tab key.  There is therefore no need to gather the separate key

presses, just regard
Quote:
> the input as being typed into a text box followed by Enter or Tab.  Should
be eezee-peezee!

> Hth

> Hugh


> > Hi,

> > I am Working on an app that scans barcodes in A97.
> > (I haven't yet purchased the slot scanner)
> > A form with tabs.
> > Theory is, on one tab, the barcode is scanned, (a number - MemberID)
> > Then find the record that matches the ID.

> > For now I am simulating what the scanner willl do.
> > The keypress events are gathered and the record is found.
> > All controls are 'locked' and 'enabled' is set to false
> > Nothing can recieve the focus but the Tab Control
> > Seems to work OK when the form is first loaded
> > The TabCtl - "Page0" is the "Screen.ActiveControl"

> > PROBLEM:
> > When the tabs are clicked more than once or tabbed to, and they actually
> > recieve the focus, no keypress events are triggered.
> > Then the "TabCtl1" is the "Screen.ActiveControl"
> > My code is on the form's keypress event.
> > Although the tab control has a keypress event, any code placed there
doesn't
> > seem to fire when keys are pressed. (The tab pages do NOT have key press
> > events)

> > Any help would be appreciated,
> > (or let me know if I'm not on track here)
> > Keith Bennett

> > Form code goes like this...
> > Private Sub Form_KeyPress(KeyAscii As Integer)
> > '********************************************************************
> > 'Gather numeric keystokes, then after the return key, find the record
> > '
> > '********************************************************************
> > On Error GoTo Err_Form_KeyPress_Err
> > Static strKeys As String
> > Dim strCharacter As String

> >     Select Case KeyAscii
> >     Case 48 To 57 ' vbKey0 to vbKey9, KeyAscii 48 to 57 (numeric)
> >         strCharacter = Chr(KeyAscii)
> >         strKeys = strKeys & strCharacter

> >     Case vbKeyReturn
> >         If Not Len(strKeys) = 0 Then
> >             Me.RecordsetClone.FindFirst "tblMembers.MemberID = " &
strKeys
> >                 If Not Me.RecordsetClone.NoMatch = True Then
> >                     Me.Bookmark = Me.RecordsetClone.Bookmark
> >                 Else ' No Match Found
> >                     MsgBox "Unable to find a MemberID matching " &
strKeys
> >                 End If
> >                 strKeys = vbNullString

> >         End If

> >     End Select



Wed, 18 Jun 1902 08:00:00 GMT  
 Tab Control and Keypress Events
I'd still use a text box and make it invisible if you don't want people to see it.  I'm sure
you'll find it lot easier than messing around with keystrokes.  By the way, if invisibility
gives any problems, then just change fore & back colour and everything else to the same as the
background.  It's not 'invisible' but you can't see it, if you see what I mean!

Hth

Hugh

Quote:

> Hi, Hugh

> Yes, I was trying to accomplish this keyboard (barcode) input without a text
> box. That is why the code was on the form's keypress event, and I was
> snagging keystrokes. I suppose I could use a text box, I just preferred not
> to for appearance.
> My question was probably more like can the tab control be prevented from
> receiving the focus, then the form's keypress events would be fired
> consistently and I wouldn't need a text box. (I'm new to barcoding)

> Thanks,
> Keith



> > On a TabControl, when you move from one page to another, using any means,
> the On Change event
> > for the TabControl fires.  I've never found a use for the On Click event
> for the Tab Control!
> > The barcode scanner usually inputs data just like a keyboard does, into a
> text box.  At the end
> > of a successful barcode scan, a configurable code is received - usually
> either a cr lf (Enter
> > key) or a Tab key.  There is therefore no need to gather the separate key
> presses, just regard
> > the input as being typed into a text box followed by Enter or Tab.  Should
> be eezee-peezee!

> > Hth

> > Hugh


> > > Hi,

> > > I am Working on an app that scans barcodes in A97.
> > > (I haven't yet purchased the slot scanner)
> > > A form with tabs.
> > > Theory is, on one tab, the barcode is scanned, (a number - MemberID)
> > > Then find the record that matches the ID.

> > > For now I am simulating what the scanner willl do.
> > > The keypress events are gathered and the record is found.
> > > All controls are 'locked' and 'enabled' is set to false
> > > Nothing can recieve the focus but the Tab Control
> > > Seems to work OK when the form is first loaded
> > > The TabCtl - "Page0" is the "Screen.ActiveControl"

> > > PROBLEM:
> > > When the tabs are clicked more than once or tabbed to, and they actually
> > > recieve the focus, no keypress events are triggered.
> > > Then the "TabCtl1" is the "Screen.ActiveControl"
> > > My code is on the form's keypress event.
> > > Although the tab control has a keypress event, any code placed there
> doesn't
> > > seem to fire when keys are pressed. (The tab pages do NOT have key press
> > > events)

> > > Any help would be appreciated,
> > > (or let me know if I'm not on track here)
> > > Keith Bennett

> > > Form code goes like this...
> > > Private Sub Form_KeyPress(KeyAscii As Integer)
> > > '********************************************************************
> > > 'Gather numeric keystokes, then after the return key, find the record
> > > '
> > > '********************************************************************
> > > On Error GoTo Err_Form_KeyPress_Err
> > > Static strKeys As String
> > > Dim strCharacter As String

> > >     Select Case KeyAscii
> > >     Case 48 To 57 ' vbKey0 to vbKey9, KeyAscii 48 to 57 (numeric)
> > >         strCharacter = Chr(KeyAscii)
> > >         strKeys = strKeys & strCharacter

> > >     Case vbKeyReturn
> > >         If Not Len(strKeys) = 0 Then
> > >             Me.RecordsetClone.FindFirst "tblMembers.MemberID = " &
> strKeys
> > >                 If Not Me.RecordsetClone.NoMatch = True Then
> > >                     Me.Bookmark = Me.RecordsetClone.Bookmark
> > >                 Else ' No Match Found
> > >                     MsgBox "Unable to find a MemberID matching " &
> strKeys
> > >                 End If
> > >                 strKeys = vbNullString

> > >         End If

> > >     End Select



Sun, 25 May 2003 08:37:03 GMT  
 Tab Control and Keypress Events
Thanks a lot for your help.


Quote:
> I'd still use a text box and make it invisible if you don't want people to
see it.  I'm sure
> you'll find it lot easier than messing around with keystrokes.  By the

way, if invisibility
Quote:
> gives any problems, then just change fore & back colour and everything

else to the same as the
Quote:
> background.  It's not 'invisible' but you can't see it, if you see what I
mean!

> Hth

> Hugh


> > Hi, Hugh

> > Yes, I was trying to accomplish this keyboard (barcode) input without a
text
> > box. That is why the code was on the form's keypress event, and I was
> > snagging keystrokes. I suppose I could use a text box, I just preferred
not
> > to for appearance.
> > My question was probably more like can the tab control be prevented from
> > receiving the focus, then the form's keypress events would be fired
> > consistently and I wouldn't need a text box. (I'm new to barcoding)

> > Thanks,
> > Keith



> > > On a TabControl, when you move from one page to another, using any
means,
> > the On Change event
> > > for the TabControl fires.  I've never found a use for the On Click
event
> > for the Tab Control!
> > > The barcode scanner usually inputs data just like a keyboard does,
into a
> > text box.  At the end
> > > of a successful barcode scan, a configurable code is received -
usually
> > either a cr lf (Enter
> > > key) or a Tab key.  There is therefore no need to gather the separate
key
> > presses, just regard
> > > the input as being typed into a text box followed by Enter or Tab.
Should
> > be eezee-peezee!

> > > Hth

> > > Hugh


> > > > Hi,

> > > > I am Working on an app that scans barcodes in A97.
> > > > (I haven't yet purchased the slot scanner)
> > > > A form with tabs.
> > > > Theory is, on one tab, the barcode is scanned, (a number - MemberID)
> > > > Then find the record that matches the ID.

> > > > For now I am simulating what the scanner willl do.
> > > > The keypress events are gathered and the record is found.
> > > > All controls are 'locked' and 'enabled' is set to false
> > > > Nothing can recieve the focus but the Tab Control
> > > > Seems to work OK when the form is first loaded
> > > > The TabCtl - "Page0" is the "Screen.ActiveControl"

> > > > PROBLEM:
> > > > When the tabs are clicked more than once or tabbed to, and they
actually
> > > > recieve the focus, no keypress events are triggered.
> > > > Then the "TabCtl1" is the "Screen.ActiveControl"
> > > > My code is on the form's keypress event.
> > > > Although the tab control has a keypress event, any code placed there
> > doesn't
> > > > seem to fire when keys are pressed. (The tab pages do NOT have key
press
> > > > events)

> > > > Any help would be appreciated,
> > > > (or let me know if I'm not on track here)
> > > > Keith Bennett

> > > > Form code goes like this...
> > > > Private Sub Form_KeyPress(KeyAscii As Integer)

'********************************************************************
Quote:
> > > > 'Gather numeric keystokes, then after the return key, find the
record
> > > > '

'********************************************************************

- Show quoted text -

Quote:
> > > > On Error GoTo Err_Form_KeyPress_Err
> > > > Static strKeys As String
> > > > Dim strCharacter As String

> > > >     Select Case KeyAscii
> > > >     Case 48 To 57 ' vbKey0 to vbKey9, KeyAscii 48 to 57 (numeric)
> > > >         strCharacter = Chr(KeyAscii)
> > > >         strKeys = strKeys & strCharacter

> > > >     Case vbKeyReturn
> > > >         If Not Len(strKeys) = 0 Then
> > > >             Me.RecordsetClone.FindFirst "tblMembers.MemberID = " &
> > strKeys
> > > >                 If Not Me.RecordsetClone.NoMatch = True Then
> > > >                     Me.Bookmark = Me.RecordsetClone.Bookmark
> > > >                 Else ' No Match Found
> > > >                     MsgBox "Unable to find a MemberID matching " &
> > strKeys
> > > >                 End If
> > > >                 strKeys = vbNullString

> > > >         End If

> > > >     End Select



Sun, 01 Jun 2003 06:13:56 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Assigning event to Shift-Tab in KeyPress event

2. KeyPress Event on Calendar Control

3. Coded Events lost link to Control when copying to a Tab Control

4. Creating Custom Event Handler (KeyPress Event)

5. Tab Control in a Tab Control

6. Control Button to Navigate Between Tabs on Tab Control

7. Tab control (pages) within 1 tab control page only

8. Setting Tab Index on controls in a Tab Control

9. Tab Control: Set focus to control on different Tab

10. Control Tabbing on Tab Control


 
Powered by phpBB® Forum Software © phpBB Group