Find record

  • Thread starter Thread starter Larry
  • Start date Start date
L

Larry

I've created a parts inventory DB and form with the part
number as primary key. The default Find Record feature
works but I would prefer to use another method to search
for a record. Using the form view I envision a field to
enter the part number and an associated command button to
locate/display the record in the form. So far I have been
unsuccessful with the macros. Any help would be
appreciated. THX

Larry
 
Create an unbound text box with the name txtPartNo then try putting the
following code in the afterupdate event of the text box

Dim rs As Object
Set rs = Me.RecordsetClone
rs.findfirst "PartNo= " & [txtPartNo]
Me.Bookmark = rs.Bookmark

If your part number is alphanumeric change

rs.findfirst "PartNo = ' " & [txtPartNo] & " ' "

Ignore the spaces before and after the ' symbol. I just did it so its
easier to read.

Kelvin
 
Back
Top