Developing a calculator in Ms Access VBA (1 Viewer)

nectorch

Member
Local time
Today, 12:49
Joined
Aug 4, 2021
Messages
41
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, 18:49
Joined
May 7, 2009
Messages
19,169
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
Today, 03:49
Joined
Oct 29, 2018
Messages
21,357
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, 10:49
Joined
Jul 9, 2003
Messages
16,244
Just found this video I did a while back. I covered basically the same thing!

Assigning Keyboard Shortcuts to a Button - Nifty Access​

 

nectorch

Member
Local time
Today, 12:49
Joined
Aug 4, 2021
Messages
41
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