Discussion Locked

About Coding--Access

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Dear All,
Here gots a simple question, maybe.
Our client is a lazy girl, she don't want to type in the digits she had to.
For instance, it is a much more comfortable way to 'click-in' through a
calculator liked window pop up when needed.
I knowthat there must be many people here know how to code one for use in
Access Forms.
May anyone of you tell me how to do this or lead me a way to the solution?
Please
Thanks in Advance!!
Best Regards!

Alan Kwok
Linkset Computer Consultants Co

6 replies

by donq

Format and Default Value properties were made for your lazy client - and if they can't help tell her to open her pocket book and pay someone to code automate her job using Visual Basic DAO and VBA, or find a job for dummies?

You don't give enoughinformation for a specific (code sample) answer.

by akwok

Dear Dong,
May I call you Dong? Is it a name?
You are right!And I posted this comment for just give you a comment! :-) HaHa, how great it is.
And, at this place and share this moment, I really appreciate your reply.
Should anybody will see this comment and the question above, please give me some useful information. And that's why we come here.....right?
Alan

by seagull data services

Hi Linkset
Firstly, I think the guy's name is DonQ but... 8o)

Anyway, as for your problem, the simplest way is to create a popup form with one textbox (txtData) and 15 buttons as follows
10 buttons labeled 0 to 9
1 button labeled "." (decimal point)
1 button for backspace (labeled del?"
1 button labeled Clear to clear the textbox
1 button labeled Cancel to close the form without making changes
1 button labeled OK to close the form and insert the data.

You will also need a public string variable in the keypad form:

public strCallingField as string

This identifies which field is calling the keypad.

The code for the number buttons would be:

addchar(0) 'for the Zero button

Each button would add a different character.

The addchar function is simple:

private function addchar(strChar as variant) as string
me.txtData = me.txtData & strChar
end function

For the Decimal Point Button:

me.txtData = me.TxtData & "."

You might want to check if there's already a decimal point with

if instr(me.txtData,".") =0 then
me.txtData = me.txtData & "."
endif

For the backspace button (Del):

me.txtData = left(me.txtData,len(txtData -1))

For the Clear button:

me.txtData = ""

For the cancel button:

RunCommand acCmdClose

For the OK Button

forms!(strCallingField)= txtData
RunCommand acCmdClose

more...

by seagull data services

To call the keyboard form, in your main form use the following in the On Enter for each field:

CallKbd

This is the CallKbd code

'Argument strCallingField is the name of the field calling the kbd

Private Sub CallKbd(strCallingField as string)
docmd.openform "frmKeyboard", acNormal
forms!FormKeyboard.strCallingField = strCallingField
end sub

I think I got everything there. If I've missed anything let me know if you can't figure it out. Final Note - it's usually quicker to use the keypad than the mouse!
Hope this helps
John

by akwok

Hi, John,
Thanks a lot for your answer, which is the best answer ever posted for a(my)question!
What's your email add? If I got more question about VBA/VB/So on, may I send mail to ask?
Thank you very much!
Alan

This discussion is closed to new replies.