Hot Keys

G

Guest

I have a input form with several fields. Field C is a total of Field A and
Field B. When the added up total does not equal the input figure a form pops
up stating the total input does not match the total of Field A and B.

On this form that pops up I want to say press [F12] to Re-edit or [F10] to
accept this figure.

How do I get my form to identify when F10 or F12 is pressed and how do I put
code in to send the cursor to a specific field based on which key is hit or
do math when the F10 key is hit.

Thanks in advance for everyones help !!!!!!!!!

Dwight
 
S

Sandra Daigle

To use the F keys, you need to write a keydown event handler that correctly
intercepts the keystrokes - a sample follows. For this to work, you have to
set the KeyPreview property of the form to True.

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyF10
'Do your calculation or whatever
keycode=0
Case vbKeyF12
'Assuming the form you want to set focus to is named 'frmMyForm'
forms!frmMyform.Text4.SetFocus
KeyCode = 0
End Select

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top