Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


re-assign key jobs in keyboard

re-assign key jobs in keyboard

re-assign key jobs in keyboard


I want to use any code in one of my form to type "000" instead of "0" when I press zero (0)..


normally when I press 1 2 3 0 will type 1230

But I need when I press 1 2 3 0 to be typed 123000

is there any body to help me?

High appreciate

Thanks & Good Luck
Ali Fekri

RE: re-assign key jobs in keyboard

There are lots of things might go wrong so you whould test this.

I would use code in the after update event of the text box:

CODE --> vba

If Not IsNull(Me.txtYourTextBoxName) Then
  If Me.txtYourTextBoxName Mod 100 <> 0 Then
      Me.txtYourTextBoxName = Me.txtYourTextBoxName * 100
      'do nothing
  End If
End If 

Hook'D on Access
MS Access MVP

RE: re-assign key jobs in keyboard

You may also try KeyPress event:


If KeyAscii = 48 Then
    Me.txtYourTextBoxName = Me.txtYourTextBoxName & "00"
End If 

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.

RE: re-assign key jobs in keyboard

What do you want to happen when you type something like:

1 0 3 0

RE: re-assign key jobs in keyboard

How are ya Fekri.

In the KeyPress event of the control in question, copy/paste the following:


   Dim ctl As Control
   Set ctl = Me!YourControlName
   If KeyAscii = vbKey0 Then
      ctl.Text = ctl.Text & "00"
      ctl.SelStart = Len(ctl)
   End If
   Set ctl = Nothing 

Also, according to the ops post origination, 1 0 3 0 = 1 000 3 000

Cheers! ...

See Ya . . .

Be sure to see FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions? Worthy Reading! thumbsup2
Also FAQ181-2886: How can I maximize my chances of getting an answer? Worthy Reading! thumbsup2

RE: re-assign key jobs in keyboard

>according to the ops post

Sure, that's what we may possibly infer from the OP, which is why I asked what the OP wanted to happen as that may not be what they meant to imply.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close