Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search Box Question

Status
Not open for further replies.

jonmitch

IS-IT--Management
Oct 15, 2002
21
US
Does anyone know how to include a seach function on a form that will bring you to the record that the person inputted? I have a Switchboard with a lot of functions and one more thing that I want to include is a Search function so that the user can type in the company name and it will bring them to another form where the record displayed corresponds to the company name that they typed in. Is this accomplised with a text box and submit button? I am new to search functions so any help would be appreciated.

Thank you
 
There's a couple of ways you could do this, I guess...

If you already have a form in which you can go through the companies one by one, you can add a button to do a search. Click on the commandbutton control and make sure "Use Wizards" is active, and then use that to create a find button.

Or, if you don't have such a form, you could indeed use a textbox and a button, then in the form it'd open, put a select query as record source, with a where-clause referring to that textbox.

Just a few thoughts, good luck.
Niki --------------------------------------
It's not the monsters under your bed, it is the men next door.
That make you fear, make you cry. Make you cry for the Child.
All the wars are fought amongst those lonely men. Unharmed, unscarred.
 
I do have 2 forms. The first is a switchboard that runs many commands, like opening reports and going to the master form, etc... The second is the master form that holds a lot of different information about each company. So, what I want to do is put a Search function on the Switchboard for Company Name and then once you hit Submit is will bring you to the corresponding record in the Master Form. Not sure of how the code will look in the record source?

Any help?
 
I have looked through other threads here and have come further along in my searcg function dilemma, but need someone to look at this code:

I have created an unbound textbox on my switchboard called txtFind and created a command button called cmdFind. In the On Click Event, here is my code:

Me.RecordSource = "SELECT * FROM Master Table " & "WHERE CompanyName LIKE '*" & txtFind & "*'"

When I type in a company name and click the command button, I get a Run Time Error '3131' saying there is Syntax Error in the FROM clause.

Does anyone know how I can get this to work?

For those who did not read my previous posts, I am trying to create a search function on my switchboard so that people can type in a company name and it will bring them to the corresponding record in the Master Form.
 
If the button is on your switchboard, you'll need to set the recordsource of the main form and not the switchboard. Also, to resolve the error, I think you need to put [Master Table].

Good luck,
Niki --------------------------------------
It's not the monsters under your bed, it is the men next door.
That make you fear, make you cry. Make you cry for the Child.
All the wars are fought amongst those lonely men. Unharmed, unscarred.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top