'Enter' Keypress?

  • Thread starter Thread starter Eric G
  • Start date Start date
E

Eric G

Just when I think I've caught all the possible 'gottchas' that my db
admin person throws at me, another inevitably surfaces.

When a button on our admin's main menu is pressed several queries are
run and then a report is opened.
After this report is opened and printed a dialogue box is presented
asking whether the report has been printed, the default reply being
'Yes'. When 'Yes' is OK'ed (pressing Enter or clicking on OK) another
series of queries are run.

Leave it to my admin person to forget to come back to the computer to
OK the printed report, and thus not have the second set of queries
run.

Because of other previous 'problems' I have implemented a timeout form
that closes the database after 5 minutes of inactivity. (many other
users make use of this computer using other programs).

So what I'm thinking of doing now is adding an 'Enter' Keypress, or
better still, a keypress that targets this OK button specifically (in
case another form is open at the time), just before the Quit command
is issued to close the app from the timeout form.

If this is reasonable could someone please tell me the VB commands to
accomplish this? Also how could I add a delay of a few seconds to
allow for the queries to be run before the app Quits?

Thanks in advance! Eric
 
You could easily do this by displaying the OK message in a small custom
form, instead of a msgbox. Check out the form-level TimerInterval property,
and Timer event, in online help.

HTH,
TC
 
Further to this: the custom form displays the message & OK button, and sets
the form's TimerInterval property to the # of seconds you want to wait,
multiplied by 1000. (Eg. 60000 to wait for 60 seconds.) The form should
also have a Form_Timer procedure. If the user clicks OK, immediately set the
TimerInterval value to zero, then proceed as required. If the Form_Timer
procedure is ever executed, this means that the user has not clicked the
button within the specified waiting period. Proceed however you wish to,
then.

HTH,
TC
 
Further to this: the custom form displays the message & OK button, and sets
the form's TimerInterval property to the # of seconds you want to wait,
multiplied by 1000. (Eg. 60000 to wait for 60 seconds.) The form should
also have a Form_Timer procedure. If the user clicks OK, immediately set the
TimerInterval value to zero, then proceed as required. If the Form_Timer
procedure is ever executed, this means that the user has not clicked the
button within the specified waiting period. Proceed however you wish to,
then.


Thanks for your help TC. I'll try to come up with an appropriate
form this weekend. Eric
 
Back
Top