help with search involving combo box

lydz

Registered User.
Local time
Today, 08:35
Joined
Mar 6, 2006
Messages
28
ive spent hours looking into searches and searching here for stuff and found some useful stuff, but still in a bit of a mess like

well, i have a search form (well 4, but theyre identical basically ;)) and it searches the table the form is based on for stuff, the user selects the field they want to search on via a combo box then enters criteria into txtCriteria then clicks a button
i know how to do this with queries, but id need about 50 queries, so its too impractical
i did write some code that slightly worked

Dim Criteria As Variant
Dim Result As Variant
txtCriteria.SetFocus
Criteria = txtCriteria.Text

Select Case Combo27
Case "Title"
Result = DLookup("[Title]", "tblBook", [Title] = "& Criteria &")
[Title] = Result
Case "ISBN"
Result = DLookup("[ISBN]", "tblBook", [ISBN] = "& Criteria &")
[ISBN] = Result
Case "Author"
Result = DLookup("[Author]", "tblBook", [Author] = "& Criteria &")
[Publisher] = Result

thats partially it, theres more cases, but identical, if it did find a record that was the same, itd load that field into the field on the table, but not the whole record, it wasnt loading into a subform, which i got thinking could be a good idea cos obviously there could be multiple results

im not really clear on how i should do this really and am looking for guidance :) does anyone have any ideas?
cheers
 
so no one wants to help me? :(
more or less got it running with a .FindFirst, but need to refine for like matches
 

Users who are viewing this thread

Back
Top Bottom