473,657 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cascading ComboBox I Just Cant Do that!

9 New Member
This is driving me mad!

I have been trying for 3 days now to work out how to do this with no success.

I have a SubForm in DataSheet View.

And a Table of "Products".
1. ProductID
2. Type
3. SubType
4. Weight (Only 1 option for each SubType)(need to fill auto)

the table look like this:
Expand|Select|Wrap|Line Numbers
  1. ProductID|Type|Subtype|Weight
  2. ----1-----Iron--Steel----5
  3. ----2-----Iron--Wood-----6.7
  4. ----3-----Gold--Dark-----55
  5.  
  6.  
In the SubForm i have this 4 as Combobox.

i want to do this:

Pick Type
and then the Subtype will requry depends on the type i choose
and after i choose the subtype the Weight and the ProudctID will Fill in Auto.

please help me.
Jan 27 '17 #1
7 1057
PhilOfWalton
1,430 Recognized Expert Top Contributor
I don't think you can the way your data is set out.

What you can do is build a form filter.
So create 2 combo boxed in the foot of the subform (I would personally use a continuous subform rather than a datasheet) with both single columns, one bound to Type and the other to SubType.

The rowsource for the first combo (Combo1) would be something like
Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT [Type] FROM Products ORDER BY [Type]
  2.  
The second Combo would be something like
Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT [SubType] FROM Products 
  2. WHERE SubType = " & Chr$(34) & Combo1 & Chr%(34)
  3. ORDER BY [SubType]
  4.  
On the AfterUpdate of Combo1 you need to do
Expand|Select|Wrap|Line Numbers
  1. Combo2.Requery
  2.  
Then build your form filter

Phil
Jan 27 '17 #2
snirben
9 New Member
ok lets remove the ProductID

i have just
1. Type
2. SubType
3. Weight (Only 1 option for each SubType)(need to fill auto)

can it be done with one table?
Jan 28 '17 #3
PhilOfWalton
1,430 Recognized Expert Top Contributor
Can I suggest that you tell us what you are trying to achieve. I know it's hard, but forget what you've got so far, let's have a bit of information on the purpose of your Db.

Anything can be done!!

Phil
Jan 28 '17 #4
snirben
9 New Member
ok, i will try to explain,
I build in access DB to my parent company,
its Steel Company.
my tables are(Not Full but the importent stuff is in):
TblProudcts
Expand|Select|Wrap|Line Numbers
  1. ProductID|Type|Subtype|Weight
  2. ----1-----Iron--Steel----5
  3. ----2-----Iron--Wood-----6.7
  4. ----3-----Gold--Dark-----55
  5.  
TblCustomer
Expand|Select|Wrap|Line Numbers
  1. CustomerID|Name|-------Phone|
  2. ----1------Moshe LTD---54545
  3. ----2------Iron LTD---45455
  4. ----3------Gold LTD---45454
  5.  
TblSuppliers
Expand|Select|Wrap|Line Numbers
  1. SupplierID|Name|----Phone|
  2. ----1------NY LTD---54545
  3. ----2------Ir LTD---45455
  4. ----3------Go LTD---45454
  5.  
Tblproject
Expand|Select|Wrap|Line Numbers
  1. ProjectID---ProjectName---CustomerID(FK)-----DateStart-----DateEnd
  2. ---3000-----Wall of steel-----2-------------28/01/2017--31/01/2017
  3. ---3001-----Iron Sky----------3-------------29/01/2017--31/02/2019
  4.  
TblBID
Expand|Select|Wrap|Line Numbers
  1. --BidID--SupplierID(FK)--ProjectID(FK)------Date--
  2. --1200------4---------------3000-------28/01/2017
  3.  
TblBidDetails
Expand|Select|Wrap|Line Numbers
  1. --BiddetailsID--BidID(FK)--ProductID(FK)--Quantity--Weight--Price
  2. -------1--------1200--------1--------------3---------5-------5$--
  3. -------2--------1200--------37-------------5---------35------10$-
TblOrder
Expand|Select|Wrap|Line Numbers
  1. --OrderID--SupplierID(FK)--ProjectID(FK)------Date---BidID(Linked)
  2. --4700--------4----------------3000-------28/01/2017--1200--------

TblOrderDetails
Expand|Select|Wrap|Line Numbers
  1. orderdetailsID--OrderID(FK)-ProductID(FK)--Quantity--Weight-Price
  2. -------1--------4700--------1--------------3---------5-------5$--
  3. -------2--------4700--------37-------------5---------35------10$-

TblCerM-When i Recive the order i need to create shipping certificate
Expand|Select|Wrap|Line Numbers
  1. --CerMID--SupplierID(FK)--ProjectID(FK)-----Date---OrderID(Linked)
  2. --9700--------4----------------3000-----28/01/2017--4700--------
TblCermDetails
Expand|Select|Wrap|Line Numbers
  1. CermdetailsID--CermID(FK)-ProductID(FK)--Quantity--Weight-Price
  2. -------1--------9700--------1--------------3---------5-------5$--
  3. -------2--------9700--------37-------------5---------35------10$-
TblInvoice
Expand|Select|Wrap|Line Numbers
  1. --InvoiceID---Date-------Total-
  2. --13000-------28/01/2017--5870$
  3.  
TblInvoiceDetai ls
Expand|Select|Wrap|Line Numbers
  1. --InvoiceDetailsID--CermID-OrderID--Total.
  2. -------------1------9700---4700-----50$

So this is how thay work:

Thay Create a project, Give it a name.
now thay need to Order Products from suppliers so thay make a
Bid and enter the Proudcts thay need. after that thay send the bid to the suplier and get back the supplier Bid to the items they ask with prices.
now thay create in Order thay "Link the Bid to the order" and all the items that in the bid Auto insert into the order Form.
Thay Create the order and send it to the suplier, now thay will recive the Proudcts in parts. 30% of the order and the rest is 70% of the order will arrive the day after or so.
they recive it with a CerM Doucment.
now thay go to the Project and open a new CerM, thay link the order to the Cerm and all the items that in the Order Auto insert into the Cerm Form.
But.. only 30% of the order is arrive. so i need to make in option to change the CerM, and he will know that.
now when i open a new Cerm and link the Order he will show me only the 70% Left.

after that in the end of the mounth i create invoice

in the invoice i can add CerM and Orders
when i add Cerm he will know that 3 more Cerm is linked to the Same Order as the first Cerm. and he will ask me if i want to add the rest of the Cerm, and if i have order with lets say 30% with out CerM he will tell me that Order didnt arrive Complletly do you want to Procced?

lets start with that i think its inaf.

by the why i need the proudcts to add as a casacde combobox, i pick type and then pick subtype(Filterd form the type) and then he will add the Weight Auto.

Thank you!
Jan 28 '17 #5
PhilOfWalton
1,430 Recognized Expert Top Contributor
Sorry for the delay in replying.

I think there are 2 options.
The simple one is to have a single combo box showing both Type & SubType which will give you your weight.
As a combo will only show the first value, I put text boxes over it with exactly the same formatting bound to the different columns. Th combo box is sent to the back

Here is an illustration,



On the final design the DDECo & DDErrorDescript ion are moved exactly over the Combo box.

The second alternative is to split your product table into
Expand|Select|Wrap|Line Numbers
  1. ProductID        1
  2. Product Type     Iron
  3.  
and a Second Table of SubTypes
Expand|Select|Wrap|Line Numbers
  1. SubTypeID        1
  2. SubType          Steel
  3. ProductID        Foreign Key
  4. Weight           5
  5.  
Then use cascading combo boxes.

Phil
Jan 29 '17 #6
snirben
9 New Member
I didn't understood the First One so well, my view is Datasheet,
I will try the second one,
but I don't need any vba code? to requry the combo box?

so I need a table of Proudcat ID with a list of the types
and a Subtype Table With Proudcat ID (FK)?

and you have idea about that: how can I make it happen? and lead?
"
in the invoice i can add CerM and Orders
when i add Cerm he will know that 3 more Cerm is linked to the Same Order as the first Cerm. and he will ask me if i want to add the rest of the Cerm, and if i have order with lets say 30% with out CerM he will tell me that Order didnt arrive Complletly do you want to Procced?"
Jan 29 '17 #7
PhilOfWalton
1,430 Recognized Expert Top Contributor
So the RowSource for the first Combo (CboProductType ) is
Expand|Select|Wrap|Line Numbers
  1. "SELECT ProductType, ProductID FROM TblProducts ORDER BY ProductType;"
  2.  
So the RowSource for the second Combo (CboSubType) is
Expand|Select|Wrap|Line Numbers
  1. "SELECT SubType, SubTypeID FROM TblSubTypes WHERE ProductID = " & CboProductType & " ORDER BY SubType;"
  2.  
Then on the AfterUpdate of CboProductType you need
Expand|Select|Wrap|Line Numbers
  1. Me.CboSubType.Requery
  2.  
Hope that helps. It's difficult to be sure without seeing the database exactly what the problems are

Phil
Jan 30 '17 #8

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

Similar topics

7
1424
by: Mike Fellows | last post by:
Below is my code that is carried out on my dataset, datagrid etc... Im trying to get column0 "Date & Time" to show date and time, not just date ive read some stuff posted by Dmitriy Lapshin on this board that goes way over my ability (this is my first vb or vb.net project). from what I can tell i need a GridColumnStyles collection adding to my datagrid but each and everytime I try to do this my code crashes.
4
7816
by: pmcguire | last post by:
I have 2 bound ComboBoxes. I want the datasource of the second to be limited by the selection made in the first. I can do this by responding to the SelectionIndexChanged event on the first, but this results in the BindingContext's Current.Row.Rowstate becoming 'Modified' whenever the BindingContext position changes. What is the RIGHT way to go about this? Thanks, -- Pat
3
1927
H0kage
by: H0kage | last post by:
Hello everyone got an assignment for college where i cant find the way to make JDeveloper to understand where the words are separated.This What The Assignment Asks.Any Tip or example to help me finish it would be greatly apreaciated.Thank you in advance. Following is an example of screen results that might appear, depending on the data the user inputs. This program asks the user for three words.
10
2716
by: ZaphodBBB | last post by:
HI I have a form with 2 comboBoxes. The first comboBox gives me a list of customers to select from. I would like to have the second comboBox populated with the names of Departments. I only want the departments listed that match the Customer selected in the first combobox. Unfortunatly the original database that the tables were drawn from (SQLServer) has one big Customers Table. It has a CustomerID for every Customer. There are multiple...
19
2318
by: Amanduh | last post by:
Hi again, brilliant developers. I'm having serious issues with cascading comboboxes. I had it working perfectly before, but then was asked to add an additional variable and everything went haywire (surely due to my incompetence). I've printed out Rabbit's tutorial and read it many times, but like others, I feel I need a more elementary approach. Please let me explain: I'm creating a database for entering information for research studies. ...
3
2301
by: Big P | last post by:
I need to make a combobox as dropdownlist that stays white. the combobox becomes gray or silver when i change it as dropdownlist. My question is: How to keep the combobox as dropdownlist in the same color "WHITE" if i have to change the drawmode then please codes to add items then. tks for your help. My Combobox as dropdownlist should be like this picture:
6
1999
by: Luke PW | last post by:
All, I am having some difficulty with a cascading list box, which doesn't seem to be co-operating. I don't do much in Access - so forgive my ignorance. For info I am using Access 2003 I have a table (tbl_topics) with 2 fields "Topics" and "Subtopics) which I am attempting to use to create some cascading combo boxes in a form, when the user selects a Topic, the subtopics field is filtered and the number of options are reduced. I...
4
1496
by: tripti agarwal | last post by:
Cascading in c programming that is the increment operators #include<stdio.h> #include<conio.h> void main() { int i=1; printf("%d%d%d%d",i++,++i,i++,++i); getch();
1
1036
by: jdusn1978 | last post by:
What is the best way for the main form combo box to bring up the correct sub-form of the 19 available? The main form has a combo box called which has the options of selecting Category 1-19. When creating a new record, the data entry user selects, let’s say, Category 3 from the combo box. I’d like the sub-form for Category 3 to appear in order for the user to finish the data entry. I’ve thought about a filtered “Next” button which leads to...
0
8310
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7333
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6167
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1957
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.