Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / July 2006

Tip: Looking for answers? Try searching our database.

Impossible? (Cross-posted in Forms forum)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jennifer_cracchiola@mastercard.com - 31 Jul 2006 19:41 GMT
I'm probably trying to do the impossible here.

I want to have a union query in a combo box to select "all" AND have
that combobox filter off of another.

I can get the first part of code working, the second part of code
working, but when I try to join into one SQL statement is bombs out.

Help!

Code Snippet for combobox filter:
SELECT Region_Country_Code_tbl.Country, Region_Country_Code_tbl.Region
FROM Region_Country_Code_tbl
WHERE
(((Region_Country_Code_tbl.Region)=IIf(IsNull([Forms]![Form2]![combo26]),[Region],[Forms]![Form2]![combo26])))
ORDER BY Region_Country_Code_tbl.Country

Code Snippet for Union query (to populate option of "all")
SELECT Region_Country_Code_tbl.Country FROM Region_Country_Code_tbl
UNION (Select  "(All)"  as Country From Region_Country_Code_tbl GROUP
BY Region_Country_Code_tbl.Country);

And here's where I'm at, which clearly isn't working.
SELECT Region_Country_Code_tbl.Country, Region_Country_Code_tbl.Region
FROM Region_Country_Code_tbl UNION (Select  "(All)"  as
Region_Country_Code_tbl.Country From Region_Country_Code_tbl, null from
Region_Country_Code_tbl) where Region_Country_Code_tbl.Region =
Forms![new_adhoc_maker_frm]![combo292];

Please help this damsel in distress!  Thanks in advance!!!

Jen
Dirk Goldgar - 31 Jul 2006 19:58 GMT
> I'm probably trying to do the impossible here.
>
[quoted text clipped - 10 lines]
> FROM Region_Country_Code_tbl
> WHERE

(((Region_Country_Code_tbl.Region)=IIf(IsNull([Forms]![Form2]![combo26])
,[Region],[Forms]![Form2]![combo26])))
> ORDER BY Region_Country_Code_tbl.Country
>
[quoted text clipped - 11 lines]
>
> Please help this damsel in distress!  Thanks in advance!!!

Did you try

   SELECT
       Country,
       Region
   FROM Region_Country_Code_tbl
   WHERE
       Region = Forms![new_adhoc_maker_frm]![combo292]
   UNION
   SELECT
       "(All)"  As Country,
       Null As Region
   FROM
       Region_Country_Code_tbl;

?
Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.