Find record on form

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
 
T

Tom van Stiphout

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
 
B

Bob McClellan

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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top