View Full Version : A Hotkey for Moving from a Datasheet to a Single Record form


Essendon
10-26-2001, 04:18 AM
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!

Chris RR
10-26-2001, 07:00 AM
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

SteveA
10-26-2001, 07:13 AM
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 http://www.access-programmers.co.uk/ubb/smile.gif

Essendon
10-26-2001, 04:23 PM
Exactly what I needed...

Thanks guys...