Command Buttons For Data Entry

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to create a form that would allow users to enter a 3 digit ID
number by clicking command buttons on the screen instead of using the
keyboard. I would arrange these command buttons to simulate a Keypad.

Should I be using sendkey for this? The problem I'm having is that the
focus of the cursor doesn't remain in the text box when clicking these
command buttons.
 
Jet said:
I would like to create a form that would allow users to enter a 3 digit ID
number by clicking command buttons on the screen instead of using the
keyboard. I would arrange these command buttons to simulate a Keypad.

Should I be using sendkey for this? The problem I'm having is that the
focus of the cursor doesn't remain in the text box when clicking these
command buttons.

You shouldn't need the focus to be in the textbox. In the Click event of
each button, just append each digit onto what's already in the textbox.

Carl Rapson
 
Just to expand on Carl's response (which is correct), make sure you're not
referring to the text box's Text property.

You do need focus to refer to the Text property. However, you don't need to
refer to that property.
 
So what you are saying is that I should do as follows:
setfocus txtBox
sendkeys "1"

Am I understanding this correctly?
 
Definitely not.

What I'm saying is that the OnClick event for the button that corresponds to
1 should be:

Me!txtBox = Me!txtBox & "1"

the OnClick event for the button that corresponds to 2 should be:

Me!txtBox = Me!txtBox & "2"

and so on.

It's seldom (if ever) a good idea to use SendKeys.
 
You don't watnt send keys.


For when the person press butiton "1"

You go:

me.txtBoxWithNumber = me.txtBoxWithNumber & "1"

try the above code.....

You simply repeat the above code for the buttons 1 - 9
 
Perfect! Thank you for your help.

Douglas J. Steele said:
Definitely not.

What I'm saying is that the OnClick event for the button that corresponds to
1 should be:

Me!txtBox = Me!txtBox & "1"

the OnClick event for the button that corresponds to 2 should be:

Me!txtBox = Me!txtBox & "2"

and so on.

It's seldom (if ever) a good idea to use SendKeys.
 
Back
Top