Find record on form

  • Thread starter Thread starter jez123456
  • Start date Start date
J

jez123456

Hi Experts
I have an access adp project connected to a sql server backend database.
I have a search form that the users enter a barcode number then clicks ok.
After clicking ok, the search form closes and a Media form opens on the
entered barcode number

I have tried 2 methods to get this to work but they seem quite slow to
retrieve the record. There are only 2,000 records and the indexing is correct.

1st method
Forms![Media].Filter = "[Barcode] = " & Me.[txtSearch]
Forms![Media].FilterOn = True

2nd method
Set rs = Forms![Media].Recordset.Clone
rs.Find "[Barcode] = '" & Me![txtSearch] & "'"
Forms![Media].Bookmark = rs.Bookmark

Is there a quicker way to achieve this?

Many thanks
 
On Wed, 14 Apr 2010 03:20:01 -0700, jez123456

I would try this:
DoCmd.OpenForm "Media", WhereCondition:="[Barcode] = '" &
Me![txtSearch] & "'"

-Tom.
Microsoft Access MVP
 
if it's a project... why not use a stored proc as the Recordsource and
then...
in the AfterUpdate event, use something like....

Forms!Media.form.inputparameters = "@BarCode = " & me.txtSearch
Barring anything out of the ordinary.. this should be an instant return for
you.

hth,
bob...
 
Back
Top