Developing a calculator in Ms Access VBA

nectorch

Member
Local time
Today, 07:55
Joined
Aug 4, 2021
Messages
54
Well I have a working calculator in my POS form but the only problem is that, to use it you need to be clicking the button . Is there a way to use keyboard button which also act like the onclick event key.

The windows calculator has both the key board usage or mouse, how can we do the same with VBA?

Sample VBA

Code:
Private Sub BtnOness_Click()
On Error GoTo Err_Handler
If lblDisplay.Caption = "0" Then
lblDisplay.Caption = "1"
Else
lblDisplay.Caption = lblDisplay.Caption + "1"
End If
Exit_BtnOness_Click:
Exit Sub
Err_Handler:
Resume Exit_BtnOness_Click
End Sub


New POS.png
 
you design your calc to use Form (pop-up) so the form can received keystroke (Keypreview).
 
Hi. Would changing the Label into a Textbox, so it can receive focus, be an option for you?
 
Just found this video I did a while back. I covered basically the same thing!

Assigning Keyboard Shortcuts to a Button - Nifty Access​

 
This is wonderful stuff, I never expected this.

Many thanks uncle Gizmo
 
Last edited by a moderator:

Users who are viewing this thread

Back
Top Bottom