How to use key find a record ?

jvincent

Registered User.
Local time
Today, 15:38
Joined
Apr 30, 2005
Messages
99
Hello to all,
Little new in Access i would like to know how to use the key to find directly to a record in a table.
ie : i have a table where the primary key (unique) is a date, using VBA i would like to know the instruction to find directly the record 01/06/2004 for exemple.
Thanks in advance.
VINCENT
 
If your form is bound to the query/table you wish to search then:
Code:
Dim FindDate As Date
FindDate = #01/06/2004#
Me.RecordsetClone.FindFirst "Format([[B]PrimeKey[/B]],'Short Date') = #" & FindDate & "#"
If Not Me.RecordsetClone.NoMatch Then
    Me.Bookmark = Me.RecordsetClone.Bookmark
End If
...replacing PrimeKey with your key name.
 
Thank you very much RuralGuy, i will try.
 

Users who are viewing this thread

Back
Top Bottom