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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a custom search button

Status
Not open for further replies.

PlumDingo

Technical User
Aug 3, 2004
46
0
0
US
Hi i hope that someone can help with this. I am new to Access code writing. I am trying to create a command button that will pop up a search field allowing the user to serach by either employee name or employee id. I do not want them to have replace as an option.

After the employee hits enter, the search box goes away and the record, if found, is displayed. If the record is not found because the information is bad then I want my own message box to appear that says that the format was not followed. Otherwise then if the employee was not found then another message for that as well.

Currently I have a find button that just opens up the find/replace menu from Access.

Can ayone help?

France
Just trying to get by.
 
Well I am little confused on some of what you wrote but you can simplifly this. You don't have to use the search. You can just send the contents AFTER UPDATE of the unbound field and try and open the form with that key. If the record is not found you can display a message on the ON OPEN event (ON ERROR) and display an appropriate message.
I am not sure what you mean by "if the information was bad".
The bottom line is if they entered in a record which is found you can display it, otherwise, display the message. If the box is on a form by itself you can just close down the other form, if it is just a field you can set the property me.fieldname.visable = false.
Also not sure what you mean "I do not want them to have the replace option".
Hope this helps. If this is what you are looking for and am having problems, respond. Otherwise, please rephrase.

Remember when... everything worked and there was a reason for it?
 
Hi. I think what you're saying is that you don't want to use the standard FIND & REPLACE menu function.

So try this instead: in Design mode, select Combo Box from the toolbox and put it on your form. Using the Wizard, pick the 3rd option ("I want to find a record based on what's picked in this combo box"). Choose Employee Name. Finish the Wizard.

Do the same thing again, but based on Employee ID.

Put the EmployeeName one to the right of the Employee Name text box on your form. I usually make the background of the combo box pale yellow, and label it SEARCH. do that for both items. Then the user knows that it's the Search thing.

Try that out and see how it goes.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top