473,398 Members | 2,113 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,398 software developers and data experts.

Cascade Comobox.... i have trying for 2 weeks now! Please Help me.

Hi, so i try everything! Nothing works for me always Problems xD

Let me Explain.

I have proudcts ,
I want to add proudcts by Combobox.
so first i want the user to pick Catagory and then MainType And then SubType and then Weight.

Catagory
MainType
SubType
Weight

So i devide my Proudct into 3 Tables
Lets say Catagory=Parit.

tblParit
Expand|Select|Wrap|Line Numbers
  1. ParitID|Parit
  2. ---1---|-Gold-
  3. ---2---|-Iron-

TblMaintype
Expand|Select|Wrap|Line Numbers
  1. MainTypeID|--MainType---|ParitID
  2. ----1-----|-Gold Sword--|--1----
  3. ----2-----|-Gold Hand---|--1----
  4. ----3-----|-Iron Door---|--2----

TblSubType
Expand|Select|Wrap|Line Numbers
  1. SubtypeID|SubType|Weight-|MainTypeID
  2. ----1----|-Long--|--33---|---1-----
  3. ----2----|-Short-|--45---|---1-----
  4. ----3----|--Half-|--67---|---2-----
  5. ----4----|-Finger|--32---|---2-----
  6. ----5----|-All---|--11---|---2-----
  7. ----6----|-Blue--|--88---|---3-----
So i create new form
Inside i have a sub form.
inside the subfrom i put 4 Combobox

1. CboParit
Expand|Select|Wrap|Line Numbers
  1. SELECT TblParit.ParitID, TblParit.[parit] FROM TblParit GROUP BY TblParit.ParitID, TblParit.[parit]; 
With AfterUpdate:
Expand|Select|Wrap|Line Numbers
  1. Me.CboMainType.Requery
  2. Me.CboMainType = Me.CboMainType.Column(0, 0)
  3.     Me.CboMainType.SetFocus
  4.     Me.CboMainType.Dropdow
n


2. CboMainType
SELECT TblMainType.MainTypeID, TblMainType.MainType FROM TblMainType GROUP BY TblMainType.MainTypeID, TblMainType.MainType, TblMainType.ParitID HAVING (((TblMainType.ParitID)=[Form]![Cboparit])) ORDER BY TblMainType.MainType;

With AfterUpdate:
Expand|Select|Wrap|Line Numbers
  1. Me.CboSubType.Requery
  2.   Me.CboSubType = Me.CboSubType.Column(0, 0)
  3.     Me.CboSubType.SetFocus
  4.     Me.CboSubType.Dropdown
3. CboSubtype
SameIdea
4. CboWeight
SameIdea

the subform is Datasheet.
My problem is when i choose new record it requery all of the recoreds and all vaules are gone.

Gif For Exemple:

Jan 30 '17 #1

✓ answered by PhilOfWalton

Sorry, I never use datasheets, only continuous forms (which are pretty similar providing the information can be placed on one line.

Your clever little GIF file appears to be working perfectly, except you don't need a dropdown for the weight.

It had me foxed for a moment till I saw the writing was in Hebrew and everything went from right to left.

What is the control source of the SubType Combo?
It should be something like
Expand|Select|Wrap|Line Numbers
  1. SELECT SubType, SubTypeID FROM TblSubTypes WHERE MainTypeID = " & CboType
  2.  
I am assuming that the Type Combo Box is bound to MainTypeID

On the AfterUpdate of the Type Combo Box you need
Expand|Select|Wrap|Line Numbers
  1. CboSubTye.Requery
  2.  
Phil

3 753
PhilOfWalton
1,430 Expert 1GB
Unless I am totally misunderstanding things, I assume that once the type & subtype are selected, the weight is known.

So MainType = Gold Hand, SubType = Finger will give weight = 32

What am I missing?

Phil
Jan 30 '17 #2
Yes you Right,
i try do that in a Datasheet view, but everytime i select a Subtype or Maintype, all the data in the previous column get Requrey and get blank.
there is a way to do it in datasheetview?
Jan 31 '17 #3
PhilOfWalton
1,430 Expert 1GB
Sorry, I never use datasheets, only continuous forms (which are pretty similar providing the information can be placed on one line.

Your clever little GIF file appears to be working perfectly, except you don't need a dropdown for the weight.

It had me foxed for a moment till I saw the writing was in Hebrew and everything went from right to left.

What is the control source of the SubType Combo?
It should be something like
Expand|Select|Wrap|Line Numbers
  1. SELECT SubType, SubTypeID FROM TblSubTypes WHERE MainTypeID = " & CboType
  2.  
I am assuming that the Type Combo Box is bound to MainTypeID

On the AfterUpdate of the Type Combo Box you need
Expand|Select|Wrap|Line Numbers
  1. CboSubTye.Requery
  2.  
Phil
Jan 31 '17 #4

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

Similar topics

2
by: Allen R. Cha | last post by:
I'm developing FTP Client. but i have a problem. System Env. : Server : wow linux, kernel ver 2.4.x client : Windows XP Home edition. I'm developing FTP Client Application. but I got error...
0
by: Squibble Code | last post by:
Hey everyone, I'm new to google groups, but I'd like to take a few seconds to introduce myself and tell people about my website. I am a computer engineering student, and love to program in C / C++...
4
by: Chuck Haeberle | last post by:
I have an interesting regular expression challenge for someone more experienced with them than I for a data layer class... I need an expression to search a SQL statement (any type, SELECT INSERT...
7
by: Paul Fi | last post by:
I have this page Index.aspx, page code shown below: void Page_Load(object sender, EventArgs e) { if (IsPostBack) { if (this.drpTypeOfStock.SelectedIndex != 0)...
0
by: daD | last post by:
Does anyone have any utilities to help with dashboard/switchboard designs?
8
by: ImortalSorrow | last post by:
Hey, I'm quite new in programing so need some help with this lottery program I'm making. What I'm trying to do is very simple, simulate a lottery but my effords are in vain since when I'm compiling...
2
by: Onlynewsopleasebenice | last post by:
Hi, I am trying to input a message into a string within my program.... however each time i input a space the program crashes. Here is the code, please help me. #include <iostream> #include...
21
by: Stevo | last post by:
Look at the userAgent string: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13 It's based on a Safari so it'll suck. Time...
3
by: Dbar10 | last post by:
In my main form I have a field that I can scroll with my mouse to advance to any name. I have put code in this field so that On Lost Focus the cursor moves to a new record in subform . My problem...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...

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.