Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

All in a combo box

Status
Not open for further replies.

mpm32

Technical User
Feb 19, 2004
130
US
I have a form that has a list box. I have query that populates the items in the list box. I have made a combo box on another form where the user picks the frequency that they want to view. They then click the Open form button and it will pull up the form with the list box filtered with their choice.

I made a Union Query to add all to the list in the combo box. The combo box list gets populated by another query.

This is the SQL in the union query.

Code:
SELECT[List:FrequencyQuery].Frequency, [List:FrequencyQuery].Frequency FROM [List:FrequencyQuery];  UNION SELECT "*", "<All>" as  FROM [List:FrequencyQuery];

When I select the <All> no records come up. It also doesn't pull up records with the blank choice, or the "-" choice. I will pull up the other choices.

In my combo box I have set the column count prop to 2, the bound column to 1.

Any idea what I'm doing wrong? I even tried making a text box that will fill with the combo box choice and referencing that in the query that pulls up the list box form but that didn't work either.

Thanks,

Mark
 
The as after "<All>" is not there that was an error it does read;

Code:
SELECT[List:FrequencyQuery].Frequency, [List:FrequencyQuery].Frequency FROM [List:FrequencyQuery];  UNION SELECT "*", "<All>" FROM [List:FrequencyQuery];
 
What is the SQL code of the RowSource property of your filtered ListBox ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
It is;

Code:
SELECT MasterRecordstbl.ID, MasterRecordstbl.Entity, MasterRecordstbl.Name, MasterRecordstbl.State AS St, MasterRecordstbl.Rep, MasterRecordstbl.TaxType AS [Tax Type], Frequencytbl.Frequency AS Freq, Frequencytbl.DueDate AS Due
FROM MasterRecordstbl INNER JOIN Frequencytbl ON MasterRecordstbl.ID = Frequencytbl.TaxID
WHERE (((Frequencytbl.Frequency)=[Forms]![ActionsForm]![FreqCombo]));
 
The combo's rowsource:
Code:
SELECT Frequency, Frequency FROM [List:FrequencyQuery]
UNION SELECT '*', '<All>' FROM [List:FrequencyQuery]

The listbox's rowsource:
Code:
SELECT M.ID, M.Entity, M.Name, M.State AS St, M.Rep, M.TaxType AS [Tax Type], F.Frequency AS Freq, F.DueDate AS Due
FROM MasterRecordstbl M
INNER JOIN Frequencytbl F ON M.ID = F.TaxID
WHERE F.Frequency = [Forms]![ActionsForm]![FreqCombo] OR [Forms]![ActionsForm]![FreqCombo] = '*'

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Excellent that works great for the all selection.

You used some abbreviations on the listbox SQL, can you explain how this works?

Also, this isn't imperative to my project but when the "-" or the blank is selected, I do not get any results in the listbox. Why is that?

Thanks for your help today. (twice)!

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top