scroll recs w/ +, - keys

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

Is there an easy way to set up using the + and - keys to scroll thru records
in single form view?

Thanx,

Rip
 
Not sure that's a good idea.

The +/- keys are used for several things, such as:
- entering numeric values;
- entering text (e.g. hypens);
- expanding/collapsing subdatasheets.

If you want to do it anyway, you would need to set the form's KeyPreview to
Yes, and use the KeyPress event, and test the KeyAscii value to see if the
keystroke was + or -. If you wish to distinguish between the +/- on the
numeric keypad and the +/- on the number row (top of keyboard), use the
KeyDown event and the KeyCode value instead, but think about how this will
work for notebook users.

Whichever event you use, the keystroke occurs inside a control, and there
are a chain of events that may need to be processed before you can move
record. That includes the BeforeUpdate of the control, its AfterUpdate, and
possibly Exit and LostFocus. Then comes the form's BeforeUpdate and
AfterUpdate events, and possibly AfterInsert. The form's Error event can
also fire at any point in that process.

Once that's all sorted, use the RecordsetClone of the form to see if there
are any records, if you are not already at the new record, and MoveNext or
MovePrevious. Test for EOF or BOF respectively, and set the Bookmark of the
form to that of the RecordsetClone.
 
Back
Top