Rolling dates by pressing "+" or "-"

B

Byron

Using Windows Vista & Access 2007

The following is taken from: Allen Browne's tips for Microsoft Access

Rolling dates by pressing "+" or "-"
Some commercial programs (Tracker, Quicken, etc) allow the user to press "+"
or "-" to increment or decrement a date without the hassle of selecting the
day part of the field and entering a new value. This is especially useful in
fields where the default date offered could be a day or two different from
the date desired.
To provide this functionality in Access, attach this Event Procedure to the
KeyPress event of your control.

Select Case KeyAscii
Case 43 ' Plus key
KeyAscii = 0
Screen.ActiveControl = Screen.ActiveControl + 1
Case 45 ' Minus key
KeyAscii = 0
Screen.ActiveControl = Screen.ActiveControl - 1
End Select

I've followed the instructions above, but I get an error at the "KeyAscii."
The Error Message says that the Variable KeyAscii not declared.
Does this indicate a missing reference, and if so which one; or is there
something else I'm missing?

Thanks for any and all assistance.
Byron
 
K

Ken Snell \(MVP\)

Allen's example assumes that you already have an event procedure in place,
and that you just need to add the steps he's posted to that existing code.

Post the entire VBA code that you have for the KeyPress event.
 

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

Top