A Hotkey for Moving from a Datasheet to a Single Record form

Essendon

Registered User.
Local time
Today, 06:29
Joined
Oct 25, 2001
Messages
65
Hi again,

I was wondering if anybody would know how to assign a hotkey so that the database user can select a record in datasheet view and go to a form displaying that record...

I am trying to achieve what the F-9 key does in a MS Works database. The user browses through the list of records, and hits F9 to view a particular record in a form.

Any ideas would be appretiated!
 
Here's maybe half of what you need. I'm not sure about the hot key, but opening the form from somewhere shouldn't be a problem.

I have users double-click in first field of the record they want to see. Then, I run the following code in the "on dbl click" event of that field. It builds a "where" condition for display of the second form:
Dim strDocName as String
Dim strLinkCriteria as String
...
strDocName = "fAddlInfo"
strLinkCriteria = "[MY_REC_KEY] = " & Me.txtRecKey
DoCmd.OpenForm strDocName, , , strLinkCriteria
 
If you want the previous code to work off the PF09, key set the KeyPreview flag to Yes on your form and place the following code in the On Key Up event:

Private Sub Form_KeyUp(KeyCode as Integer, Shift as Integer)

If KeyCode = 120 and Shift = 0 Then
strDocName = "fAddlInfo"
strLinkCriteria = "[MY_REC_KEY] = " & Me.txtRecKey
DoCmd.OpenForm strDocName, , , strLinkCriteria
End If

KeyCode 120 and Shift 0 equals the F9 key.

HTH
SteveA
smile.gif
 

Users who are viewing this thread

Back
Top Bottom