code for duel functions

action

Registered User.
Local time
Today, 15:37
Joined
May 29, 2003
Messages
89
Can anyone tell me if this can be done:

I have a function opening a form and passing a selected record by a click in a listbox and also want the enter/return key to do the same function. the code used is below (some may recogise bits of it)

any pointers?




Private Sub lstResults_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "FRMmembers editor"

stLinkCriteria = "[ID]=" & Me![lstResults]
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub
 
Use the List Box's KeyPress Event.

Code:
Private Sub lstResults_KeyPress(KeyAscii As Integer)
     If KeyAscii = 13 Then Call lstResults_DblClick(0)
End Sub
 
not quite working

thanks Travis, got the idea but something isn't right. I will have a detailed look later.

I might come back to you on this.

Where can I read up on keycalls and code?

Regards
Rob
 

Users who are viewing this thread

Back
Top Bottom