Simulating a context-sensitive call to help.

C

Chaplain Doug

Access 2002. I have a custom help file created by HTML
Help Workshop. I now know how to simulate a call (F1 key)
to my help with SendKeys "(F1)",true. How may I simulate
the F1 and also pass a context ID to my help file? I have
a button that runs the SendKeys. But I want to be able to
determine the last control the user was in before pressing
the ? button, then set the context accordingly and call my
help file (.chm) passing the context. Thanks.
 
D

Dirk Goldgar

Chaplain Doug said:
Access 2002. I have a custom help file created by HTML
Help Workshop. I now know how to simulate a call (F1 key)
to my help with SendKeys "(F1)",true. How may I simulate
the F1 and also pass a context ID to my help file? I have
a button that runs the SendKeys. But I want to be able to
determine the last control the user was in before pressing
the ? button, then set the context accordingly and call my
help file (.chm) passing the context. Thanks.

I'm not sure whether this will work for your purposes, but you could use

Screen.PreviousControl.SetFocus

to send the focus to the last control that had the focus before the user
clicked your command button.
 
G

Guest

Screen.PreviousControl.SetFocus
SendKeys "{F1}", True


It worked to bring up context sensitive help for the
control in which the user's cursor was before pressing
the ? button. I set the Context ID for that previous
control and it picked it up. Thanks!
 
D

Dirk Goldgar

Screen.PreviousControl.SetFocus
SendKeys "{F1}", True


It worked to bring up context sensitive help for the
control in which the user's cursor was before pressing
the ? button. I set the Context ID for that previous
control and it picked it up. Thanks!

Great! Be aware that SendKeys has (or at least had until recently) a
bug that would affect the NumLock setting on the PC's keyboard. On top
of that, you're never really 100% sure where those keys are going to go,
once you've used SendKeys to put them in the queue. So I'd recommend
avoiding SendKeys if you have any workable alternative. Unfortunately,
I haven't been able to think of one for your current purpose. :-(
 

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