UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Using The Like Condition In A Query, Access 2007    
 
   
josephbupe
post Jun 13 2018, 06:22 AM
Post#1



Posts: 811
Joined: 23-January 08
From: Lusaka,Zambia


Hi,

I have a query named qryEvents_Search and I want to include in it conditions to filter database based on multiple fields on a a form frmEvents_Search. Basically, the controls on the form includes:

txtEvent_name
cboCountry
txtStartDate
txtEndDate

How should the criteria for each of the fields look like in the query qryEvents_Search parameters? For a start I tried this on the Event_name field, but it works only when i type in the first word of the event. I want it to query any part of the event name:
CODE
Like IIf([Forms]![frmEvents_Search]![txtEvent] Is Null,"*",[Forms]![frmEvents_Search]![txtEvent] & "*")
But this only

Later, I will be exporting the qryEvents_Search's results to a doc file.

Thanks

Go to the top of the page
 
theDBguy
post Jun 13 2018, 07:16 AM
Post#2


Access Wiki and Forums Moderator
Posts: 72,396
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Try:

Like Forms!FormName.TextboxName & “*” OR. Forms!FirmName.TextboxName Is Null

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
GroverParkGeorge
post Jun 13 2018, 08:44 AM
Post#3


UA Admin
Posts: 32,790
Joined: 20-June 02
From: Newcastle, WA


Maybe an extra period in there? After OR?

--------------------
Go to the top of the page
 
theDBguy
post Jun 13 2018, 09:42 AM
Post#4


Access Wiki and Forums Moderator
Posts: 72,396
Joined: 19-June 07
From: SunnySandyEggo


Oops! Darn phone keyboard (double space)! Sorry (I also misspelled "FormName").

Should be:

Like Forms!FormName.TextboxName & “*” OR Forms!FormName.TextboxName Is Null

Thanks, George!

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
josephbupe
post Jun 13 2018, 09:51 AM
Post#5



Posts: 811
Joined: 23-January 08
From: Lusaka,Zambia


Thanks.
Go to the top of the page
 
theDBguy
post Jun 13 2018, 10:05 AM
Post#6


Access Wiki and Forums Moderator
Posts: 72,396
Joined: 19-June 07
From: SunnySandyEggo


Hi,

You're welcome. George and I were happy to assist. Please let us know if it doesn't work.

Good luck!

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    20th June 2018 - 06:15 AM