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

search using form 2

Status
Not open for further replies.

knaya

MIS
Dec 4, 2003
51
US
i might have been explaining this the wrong way..i'm dieing here, i have a table, it has 5 field names e.g prodid, prodname etc..what i want to be able to do is enter the prod i.d and click a command button and have the rest of the fields appear below (that is if the prodid is valid).. someone please helpppppppp...
 
Do you know how to do VBA coding? This would be the easiest way if you do i would think

dyarwood
 
I might be on the wrong track here, but might the combobox wizard be able to do this?

This assumes the form has the table you wan't to search as recordsource.

When using the wizard, first select the "Find a record on my form..." variant, select the relevant fields (id and for instance prodname), in the next step of the wizard is the option to hide or not the key column.

With a check mark, you'll be able to search by prodname (type or select)

Uncecked, the combo will allow you to type the prodid (or select)

- and if match, display the complete record in the form.

This will happen on the after update event of the combo. If you want it to happen on a command button click, copy/paste the code from the combos update event to the buttons on click event. If you wan't the search control to be a textbox, then use a reference to the textbox control in stead of the combo.

HTH Roy-Vidar
 
Knaya,

There are several approaches to this problem.

One you could use the filter properties of the form. Basically what it would do is load all records into the form and then once you enter the ProdID into a unbound text field and press the command button it would filter that form based on the prodid. If you know a bit about coding you can also make it tell you if it didn't find the field by checking for the BOF and EOF of the recordset. (If there is no BOF and EOF there are no records)

Two you can programatically "make" the SQL statement that your form is based on. The form would be unbound on open but once you enter the ProdID into a text field and press the command button it would create the SQL satement and place it into the recordsource for the form. This is the approach that I would go with.

Let me know which one you would like help with and I will see what I can do.

Chris

 
cant you just use the microsoft access search facility provided to search via the prodid field.

the simpler the better!
 
Roy-Vidar and Chris,
you guys are aweeeeeeesommmmmmeeee, for real, i'm going to go work with your suggestions and see how it works out.. Again, thanks a lot, i'm glad at least someone responded..i appreciate it..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top