Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Click Equivalent?

Status
Not open for further replies.

Dummy99

Programmer
Apr 25, 2002
30
0
0
FR
Can anyone tell me how I can get the equivalent of a Click or Double Click by using the keybord, e.g. using the Enter key.

I have one and only control in a continuous form and it has a subform to it. To get the sub form, my user has to do a double click on the control item he's interested in. But to leave the keyboard to go to the mouse, point and Double Click is a nuisance and above all an energy waster!

Do I use the KeyDown or ??? I just can't see what other event I could use.

Thanks
Michael
 
Is there a way for your user to Tab to the control? The subform should be part of the tabbing order. Maq [americanflag]
<insert witty signature here>
 
Hello Mag,

The form has only one control so the tabbing order is just that one control. It's a continuous form so the records get displayed on the screen as follow:

rcd1 (in the one control) & this one has the focus to start.
rcd2 (in the one control)
rcd3 etc.
It all shows as one display and to the user looks like just one form/one-page but it is in reality a bunch of short form/short-pages.
The user can press the Tab, or the arrow keys to move to the focus to the next record. If that is his record of interest he can then double click the control and the program takes him to the sub form giving details concerning his particular record of interest. And this is where I would like to provide a key option to the double click. At this stage one cannot use the Tab key because that will move the focus to the next control/record.
I said a &quot;sub form&quot;. Perhaps I should not call it that and just say &quot;another form&quot;.

Thanks,
Michael
 
Hmm, I'm not sure if this would work (I haven't tried it), but perhaps you could put some code in the sub-form's on_current event to set the focus to that control.

me!controlname.setfocus Maq [americanflag]
<insert witty signature here>
 
Maquis,

Thanks for you help. The &quot;On-Current&quot; in the sub-form didn't work but I found a solution:

In the &quot;On Key Down&quot; of the control in my main form I entered &quot;[Event Procedure]&quot; and coded the procedure as follows:

Private Sub SolutionCell_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '13 = Enter key
Call procedure to open subform
Exit Sub
Else
End If
Exit Sub
End Sub

So when the user hits the enter key while in the control of his choice, the procedure gets executed and so does the Call for the sub form, etc, etc. etc. If he hits someother key like Tab or Down Arrow to go to the next control, the above code gets executed but not the Call for the sub form procedure and the user's focus moves the next control. Don't forget, the control in this case is always the same one but in the next form / next record (although the screen appearance is one form (due to the &quot;Continuos Form&quot; specification).

Hope it helps you sometime!
Thanks again,
Michael

Two heads are better than one!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top