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

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Query Parameter from Combo Box    
 
   
luvfuzz
post Aug 26 2005, 02:01 PM
Post #1

UtterAccess Veteran
Posts: 461
From: Indiana



Using report, based on Query, which derives a certain parameter from a combo box control on a form. When I press a button on the form, it launches the report. The control's source is a table

I am trying to figure out a way to allow the control to have an ALL function.

My only idea has been to simply add a record to the appropriate table that just says ALL, then, in the query criteria I used an IIF statement to say that if the control value was anything other than the ALL entry, use the control value, otherwise, do not include the criteria.

CODE
IIf([Forms]![frm_reportParameters].[cbo_facility].[value]<5,[Forms]![frm_reportParameters].[cbo_facility].[value],<=5)


(there are only four records in tbl_facility, the fifth is the ALL entry). When I select any facility, it works as expected, but when I select ALL, the query returns no entries.

Any ideas?
Go to the top of the page
 
+
dashiellx2000
post Aug 26 2005, 02:06 PM
Post #2

UtterAccess VIP
Posts: 9,209
From: Maryland



You may just want to use "" instead of the <=5. Also, you may want to use a dynamic query. Check here for more info.

HTH.
Go to the top of the page
 
+
ScottGem
post Aug 26 2005, 02:06 PM
Post #3

UtterAccess VIP / UA Clown
Posts: 25,090
From: LI, NY



See here
Go to the top of the page
 
+
fkegley
post Aug 26 2005, 02:24 PM
Post #4

UtterAccess VIP
Posts: 23,583
From: Mississippi



I have prepared a demo showing how I would do it. See CategoriesCriteriaForm in the attached example.
Attached File(s)
Attached File  AllDemo.zip ( 85.74K ) Number of downloads: 9
 
Go to the top of the page
 
+
luvfuzz
post Aug 26 2005, 03:15 PM
Post #5

UtterAccess Veteran
Posts: 461
From: Indiana



AHHA!!!! I thought you had lost me...but I got it. The example was extremely helpful. It took some thinking to realize that you were just choosing from one of the two queries. I thought you were using one query no matter what.

Thanks for the help.
Go to the top of the page
 
+
fkegley
post Aug 26 2005, 03:38 PM
Post #6

UtterAccess VIP
Posts: 23,583
From: Mississippi



You're welcome. That seemed like the KISS way to me. I always pick the KISS way.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 24th May 2013 - 09:18 AM