PC Review


Reply
Thread Tools Rate Thread

Impossible? (Cross-posted in Forms forum)

 
 
jennifer_cracchiola@mastercard.com
Guest
Posts: n/a
 
      31st Jul 2006
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

 
Reply With Quote
 
 
 
 
Dirk Goldgar
Guest
Posts: n/a
 
      31st Jul 2006
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)
> 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!!!


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;

?
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I have a million questions - forms, forms, forms Cristy Microsoft Outlook Form Programming 1 1st Oct 2008 06:41 PM
Windows Forms - Opening forms within forms Dan Tallent Microsoft C# .NET 20 27th Aug 2008 06:25 PM
How to put my own forms in the "Personal Forms Library" or in the toolbar Marco J.L. Microsoft Outlook 1 21st Jul 2004 03:33 PM
Calling Forms from Forms - Exit problems Stuart Microsoft Excel Programming 3 25th May 2004 06:50 AM
Publishing forms to Organizational Forms RB Microsoft Outlook 0 25th Feb 2004 07:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:35 AM.