Developing a calculator in Ms Access VBA (2 Viewers)

nectorch

New member
Local time
Today, 04:41
Joined
Aug 4, 2021
Messages
28
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
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:41
Joined
May 7, 2009
Messages
16,080
you design your calc to use Form (pop-up) so the form can received keystroke (Keypreview).
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 19:41
Joined
Oct 29, 2018
Messages
18,745
Hi. Would changing the Label into a Textbox, so it can receive focus, be an option for you?
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 03:41
Joined
Jul 9, 2003
Messages
14,442
Just found this video I did a while back. I covered basically the same thing!

Assigning Keyboard Shortcuts to a Button - Nifty Access​

 

nectorch

New member
Local time
Today, 04:41
Joined
Aug 4, 2021
Messages
28
This is wonderful stuff, I never expected this.

Many thanks uncle Gizmo
 
Last edited by a moderator:

Users who are viewing this thread

Top Bottom