|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Wildcard query from form
Hi. I'm trying to get a form based query going for a database of individual dolphin sightings. The relevant fieldsare "dolph1" dolph2", up to "dolph45" (an individual animal is entered into these, starting at dolph1 and continuing until all animals are in one of the fields (randomly entered)) and *more importantly* there is a final field called "dolphs" -- with all of the individuals in it, each seperated by a space. So I can filter for individuals in that field, and I can query for them as well by entering Like "*bktl*", where bktl is a code for 1 animal I am interested in.
My difficulty is in running a wildcard query in conjunction with a form. I want the user to enter the animal they are interested in via a form, then a cmd button will run a query in the "dolphs" field -- which would make it a wildcard. I have tried Like " * Forms![animals]![txtAnimal] * ", where my form name is animals and the txt box with input is txtanimal. I get no records. Any ideas? |
|
#2
|
||||
|
||||
|
Don't put any spaces in your LIKE statement - the DB checks for the exact string. So your query should look like:
Code:
WHERE dolphs LIKE '*Forms![animals]![txtAnimal]*' |
|
#3
|
|||
|
|||
|
Thanks
I'll try that -- JanGann
|
|
#4
|
|||
|
|||
|
No luck with that
I tried the "where dolphs Like '*Forms![animals]![txtAnimal]*' with no luck (see attached .gif of query). Any more ideas out there? Any help is greatly appreciated! -- JanGann
|
|
#5
|
||||
|
||||
|
This might help: http://www.tek-tips.com/gviewthread.../702/qid/765252
|
|
#6
|
|||
|
|||
|
It worked!
Needed the &'s in there. Here's the query criteria:
Like "*" & [Forms]![FormName]![EntryFieldName].value & "*" Thanks for the link. -- JanGann |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > Wildcard query from form |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|