473,378 Members | 1,451 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Give the right options in a combo

Hi Guys,

I am somehow new with access so I hope you can help me with this.

I have two tables.

1. database (date of arrival, productgroup, variety, number of cartons)
2. products (productgroup, variety)

Within the table products I have a lot of products:

PRODUCTGROUP VARIETY
APPLE VARIETY1
APPLE VARIETY2
APPLE VARIETY3

PEAR VARIETY1
PEAR VARIETY2
PEAR VARIETY3


Now I made one form with a subform that contains the databse.

ALL GOOD SO FAR.

Now within this subform I'd like to add all the information and I allready made something so that you can choose with a combo the Productgroup and variety.

Now because this has become a big list it's not very easy working with it. So my idea is that if you first choose the productgroup it automaticly filters in a combo and it gives you only the varietys for example apple and not of the pear.

Is this right?

,Select [VARIETY] from [PRODUCTS] Where [productgroup] like [VARIETY],

and where do I place this so that it works??


thank you so much!
Feb 4 '10 #1
1 1151
TheSmileyCoder
2,322 Expert Mod 2GB
Assuming your combobox for selecting productgroup is called cmb_Product and your combobox for selecting Variaty is called cmb_Variaty you would do:

cmb_product should have a rowsource:
Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT Productgroup from tbl_Products;
And you add an event procedure to the AfterUpdate of the cmb_Product:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmb_Product_AfterUpdate()
  2. Me.cmb_Variaty.Requery
  3.  
  4. End Sub
  5.  
The cmb_Variaty should then have a rowsource such as:
Expand|Select|Wrap|Line Numbers
  1. SELECT Variaty from tbl_Products WHERE Productgroup=Forms![myFormName]![cmb_Variaty] 
That said, your database is not properly Normalized, and I suggest you read up on that in our insights forum. We have a very good articled there by msquared:
Datebase Normalization and Table Structures
Feb 4 '10 #2

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

Similar topics

2
by: ahoodless | last post by:
hi i have a problem that I have tried desperately to tackle but cannot seem to complete. basically i am trying to create a form with three dropdown lists, the tricky part is i want the 3rd drop...
3
by: joni b | last post by:
I need help limiting the options shown in a combo box. I have two combo boxes that appear in a datasheet view subform. The form looks like an Excel spreadsheet, which is what the user prefers....
1
by: Lucas Sain | last post by:
Hi, I'm trying to create a property in a class that should be apepar as dropdown combo at design time with X options. Something like the WindowStateProperty where you can select 3 options. How...
2
by: kiranmn75 | last post by:
I want to dynamically populate a combo box through javascript. Data is coming from a array. Sometimes data list may contain items in excess of 2000. Explorer takes more than 5 seconds to...
4
by: Miguel | last post by:
I have an order entry database with two forms. One is for new orders the other is to update orders. The forms are identical except that one is strictly order entry. On both forms are three sets of...
3
by: dufnobles via AccessMonster.com | last post by:
I have a form that displays a dropdown box. The options in the drop down vary according to a value queried from a database boolean (Yes/No) field. I would like to do the following: If the...
12
by: Reg (Lincolnshire) | last post by:
Converted an A2003 system to A2007, on testing founf out that right- click to bring up a shortcut menu on a combo box didn't work if the combo box was in a subform. Found out that this was a...
3
by: Tyler | last post by:
In the combo box wizard there are typically 3 options, the last one being to find a record based on the selction in the combo box. Nevertheless, sometimes when I try to add a combo box the third...
16
by: bbatson | last post by:
Hello, Suppose I have combo box that is linked to the following SQL statement: "SELECT DISTINCT Column1 FROM Tbl1;" Suppose the results are 3 fields: Red, Green, Yellow What if I wanted to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.