Finding a Record

Lourry

Registered User.
Local time
Today, 13:32
Joined
May 19, 2004
Messages
41
Hello to all Access experts,

Can someone tell me how to put and code a "Find Record" button on a form? I tried putting the default "Find Record" button and tried it out but it's not exactly what I need.

Is there a way, that I can create a command button, then when a user clicks on it, it will open up a blank form that looks just like the main form, then the user fill in the fields and click on another button on the form and it searches the database for the matching fields and display the records?

Is my explaination clear enough?

Please help! Many thanks!

-Lory
 
Here is a sample Db that has some basic search function one of which is what u are after.
 

Attachments

here another good one.

I have good library of search function. I these arent what you need I can send some more on Monday.

Please note that you will need to alter some of control names in the code to your control name.

Im assuming that your VB is basic but I could be wrong.

I hope the sample help.

Good luck!.
 

Attachments

Last edited:
Thanks!

I'll try them out now. Thanks again.
 
Hi stargate,

The two zip files are very useful! Thank you!
In the SearchingOptions.zip....
I'm having trouble with the line:

stLinkCriteria = "[Name ID]=" & Me![lstNames]

this is located under Private Sub lstNames_Click() in frm Wild Search.

This is actually my first time using Access, and I have limited knowledge on the syntax used. I have created a textbox called txt_ID in place of the listbox in the example. and I need to match whatever the user typed in there to a field called ID in a linked table called Table1.

How do I rewrite this line so that it will look for all the records that ID=txt_ID.value and display only those records in the original form?

I tried stLinkCriteria = "[Table1.ID]=" & Me![txt_ID] but when I run it, it pops up with a separate message box titled "Enter Parameter Value" and the code afterwards does not work.

I'm using Access 97, please advise on what I should do. Please and thanks a lot....again!!

-Lory
 
your problems is simple. dont use [Table1.ID] as it is confusing. It should read something like this..eg PersonID. To me table 1.ID is a table not a text control.

I would check all the syntax in the sample you are using make where ever Name ID or is mention lstNames is mention, changed it to your control name. Name ID is the control form the autonumber in your table that hold the data for the form. Also look at the record source in the list box sample and you need to alter that as well.

send a copy of your DB is you still need help.
 
Filter by form is a built in feature of Access. You don't need any code to use it.

1. Open any form in form view
2. Under Records/Filter - select Filter by form
 

Users who are viewing this thread

Back
Top Bottom