By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,844 Members | 1,472 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,844 IT Pros & Developers. It's quick & easy.

Query from Form Using All (*) as a selection option in a Combo box

P: 30
I have a combo box [ComboSelectGPAgent] on the form [Frm_Main_Menu] which is used as the criteria for a field [GP Agent] in the query [Qry_Cadbury_Data_Linked_to_BT_Data_By_Vol].

I want to be able to run the query for a specific [GP Agent] or all agents. I have added to the row source of the combo box the following code:-

Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT Qry_Cadbury_Data_Linked_to_BT_Data_By_Vol.[GP Agent] FROM Qry_Cadbury_Data_Linked_to_BT_Data_By_Vol; UNION SELECT '*' AS [GP Agent] FROM Qry_Cadbury_Data_Linked_to_BT_Data_By_Vol;
and added the following code to the crieria of field [GP Agent] in my query:-

Expand|Select|Wrap|Line Numbers
  1. [Forms]![Frm_Main_Menu]![ComboSelectGPAgent]
The combo box now includes the option * but when I select * my query returns no records. if I select a specific GP Agent the query does return the records for the GP Agent

Please can some one explain why my wildcard does not work when picked up from the Combo Box from my form and how I can get this to work.

Much Appreciated!
Sep 11 '07 #1
Share this Question
Share on Google+
3 Replies

Expert Mod 10K+
P: 14,534
Change the criteria to

Expand|Select|Wrap|Line Numbers
  1. Like [Forms]![Frm_Main_Menu]![ComboSelectGPAgent]
The wildcard will only work with a Like statement
Sep 13 '07 #2

P: 30
Problem solved

I was just one word out on my code but that one word makes all the differece.

Thank you for taking the time to look at my problem I have been trying to solve it for a few day and without your help I would have spent many more hours on this.

and bonus I think it may help me solve another problem I'm facing I'm going to try it out now.
Sep 13 '07 #3

Expert Mod 10K+
P: 14,534
You're welcome. Glad its working for you.
Sep 13 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.