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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hit return key to display requested data

Status
Not open for further replies.

Noshy

Programmer
Jan 12, 2003
7
GB
Hello

Im not sure if this was already mentioned somewhere in this forum! I am wanting my users to hit the return/enter and open the specific form with the required info. ie Type the data to open within a field ,hit the return key and the DB searches and opens the relevant info. At the moment after hitting the return it jumps to the next tab.

Thanks for any input
 
you could try the form_keyDown sub.

Private Sub Form_KeyDown(KeyCode As Integer, Shift _
As Integer)

Select Case KeyCode
Case vbKeyReturn
'Do something
Case Else
End Select

End Sub

You have to set the Form control keyPreview to True

yourForm.KeyPreview = True

Hope this helps
 
Hi ausMuenchen

Thank you very much for your answer. I have tried what you have advised however I think the problem I am having is at the myform.KeyPreview = True. I have added on the event selector of my form &quot;Yes&quot; however it still appears to be jumping to my next tab field. <==probably something really simple and as usual Im managing to complicate matters.

Thanks again
 
here is what i came up with, i was looking for the same solution. i had to put the me.refresh in there cuz it was running the search from before.

anyway, this works for me...


Private Sub txtFirstName_KeyDown(KeyCode As Integer, Shift As Integer)

Select Case KeyCode
Case vbKeyReturn
Me.Refresh
Call cmdSearch_Click
Case Else
End Select

End Sub

I have a button they can push if they want to use the mouse, but i wanted to have them have the option that if they hit enter it would run the button, thats what the cmdSearch_click is.

Smiley
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top