If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Combo box in a query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-08-03, 23:21
mikeg950 mikeg950 is offline
Registered User
 
Join Date: Sep 2003
Location: Hamilton, NZ
Posts: 25
Post Combo box in a query

Hi there

I would like to put a combo box in a query. In my main table I have a field called Category (friends, business contacts etc) where it is a combo box where users are able to select a category.

I am wanting to make a query where it also has this drop down box so users can also choose from this and then I can can turn the results into a report.

SELECT Contacts.Title, Contacts.FirstName, Contacts.LastName, Contacts.Category, Contacts.Home_PhoneNumber, Contacts.Home_CellPhoneNumber, Contacts.Business_PhoneNumber, Contacts.[Business_Cell phone]
FROM Contacts
WHERE (((Contacts.Category)=[Please select the category]));

I'm not sure how to put the combo box in here. Can anybody out there help me.

Thanks

Mike
Reply With Quote
  #2 (permalink)  
Old 09-10-03, 22:37
mikeg950 mikeg950 is offline
Registered User
 
Join Date: Sep 2003
Location: Hamilton, NZ
Posts: 25
Hi there again

I may have not explained this good enough and have since reliesed part of the reason where I am going wrong. I need to get this from a form.

I am triing to put a combo box from a form [contact] into my query so the user can choose options.

SELECT Contacts.Title, Contacts.FirstName, Contacts.LastName, Contacts.Category, Contacts.Home_PhoneNumber, Contacts.Home_CellPhoneNumber, Contacts.Business_PhoneNumber, Contacts.[Business_Cell phone]
FROM Contacts
WHERE ((Contacts.Category) Like [forms]![Contact]![Category]);

I know I am almost there from rearch in other areas but the combo is not happening.

Can any body help me.

Mikeg950
Reply With Quote
  #3 (permalink)  
Old 09-10-03, 23:45
Dgillies Dgillies is offline
Registered User
 
Join Date: Aug 2003
Posts: 14
Here's one way but not using SQL, create a form using the wizard based on your contacts table and the fields that you want your query to look up, convert the boxes into combo boxes so that they are containing relevant data, then point your query at the combo box and form for the information.


WHERE ((Contacts.Category) Like [forms]![contactsearchform]![Comboboxname]);
Reply With Quote
  #4 (permalink)  
Old 09-15-03, 05:46
mikeg950 mikeg950 is offline
Registered User
 
Join Date: Sep 2003
Location: Hamilton, NZ
Posts: 25
Thank you Dgillies

I have reliesed that you are unable to make a query in SQL with a built in combo box. So from your idea and others I have made a form with the combo box and the query compares the data in the Contacts.category with the data in the new form "Choose Category".

WHERE (([Contacts].[Category]) Like [forms]![Choose Category]![Choose Category]);

Now as you know when you want the query to run you click the "Preview phone no" button which opens the "Choose Category" form where you select from the combo box the category that you want the report to create. I have made a button on this "Choose Category" form where it then opens the Form "Phone numbers by category". This is now running great.

I will now be able to use this concept with the Birthday Report.

Choice thanks again.

Mikeg950
__________________
Mikeg950
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On