Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 23rd, 2005, 05:02 PM
krisw538 krisw538 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 24 krisw538 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 16 m 59 sec
Reputation Power: 0
Combo Boxes & query

I have a main table and a form built on it
From the form there are two combo list boxes
The first one is for Type (of animal)
The second is for Breed (ex. of cats or dogs)

I have another table which the combo boxes are using that list fields "type" and "breed"

I have a query built on the table to filter by type. If "type" chosen on form is "dog", then the combo box for breed should pull only dog breeds from the query and offer only those options for the drop down to choose breed. Same situation for cat, where if type=cat, then choices for breed drop down should include only cat breeds.

How on earth to I achieve this goal? I've tried many things although I'm not sure how to do any of them correctly

Thanks for any help

Reply With Quote
  #2  
Old August 23rd, 2005, 05:32 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
The basic principle here is to cascade your comboboxes. For example your combobox that represents "type" will have the row source based on the table that has your type and breed. The combobox for the breed will have the rowsource based on a query of the same table. In the query you will set the criteria under the "type" field to your "type" combobox, something like this:

Forms!FormName.Combobox....using the correct form and combobox names.

Then in the After Update Event of your "type" combobox enter
Me.ComboBoxBreed.Requery ... use the correct name of your breed combobox

This will requery your combobox to show only those records filtered by the "type" from the "type" combobox.

If you still run into difficulties, post back with the correct table, query, and form control names in your application and I can get you more specific code examples.

lwells

Reply With Quote
  #3  
Old August 23rd, 2005, 06:47 PM
krisw538 krisw538 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 24 krisw538 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 16 m 59 sec
Reputation Power: 0
I'm still having problems. I know I'm not doing something right.

Anyway, here are the names.

frm_Registered based on tbl_Registered
Combo box "Type" from tbl_Breeds with field "Type"
combo box "Breeds" from qry_TypeBreeds"

I made the changes and here's the status now...

Combo box "Type" repeats or is not grouped (ex. Dog, Dog, Dog, Dog, Cat, Cat, ... and on and on, one for each record)
Row Source says this:
SELECT [tbl_Breeds].[Type] FROM tbl_Breeds;

Also, with the same combo box "Type" after selecting an option it says the database can't find the macro 'Me.'
I put this in "After Update": Me.Breed.Requery

I feel so stupid. I know this is easier than I'm making it but I can't get past this block.

Thank you so much for your help


lwells[/QUOTE]

Reply With Quote
  #4  
Old August 23rd, 2005, 07:14 PM
krisw538 krisw538 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 24 krisw538 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 16 m 59 sec
Reputation Power: 0
I made a few adjustments during a logical moment. I looked at the row source in th sql view and after grouping the field the first problem was solved. I also put the Me.Breed.Requery in the form of a macro since it was looking for one. That fixed the second problem. Thank you again for everything. I've been stuck on this most of the day.


Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Combo Boxes & query


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT