Click here to Skip to main content
15,890,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Everyone, i just started building my own Windows Form in VB.NET Project (Ver 2017),
and i just Wanted to know how to make VB.NET Cascading Combobox via OLEDB/Connect Ms Access Database which Similiar like Cascading Ms.Access method
or maybe make VB oledb Read the "Query" of existing Access Database & Populate it into VB Combobox with just similiar like i did on Ms.Access below ?


Btw i'm an beginner in VB and needs Specific/Detailed Solutions also only Wanted for VB Code Answers, and i believe you guys are sooo Expert for this case and able to help me and give Better Solutions with ease :)

*Already trying Googling, even on youtube, etc for Days but i can't get the specific answer which all of them only has info for connecting VB to Access Database or Populate the Access Database data into VB.NET ComboBox via OLEDB Only

- Thanks in advance

Cheers

What I have tried:

At Ms.Access i can make it works by do following things:

my Form Named FrmPlaceDir which on there has 3 ComboBox

Combobox1 has name: CboState (Main Cbo/First Cbo to populate another Cbo/2nd)
Combobox2 has name: CboCity (This Cbo List Item will Populate depend from CboState Selection )
Combobox3 has name: CboZipCode (This Cbo List Item will Populate depend from CboCity Selection)

Also the 3 Tables that i was created for populate Each Cbo Ddata in FrmPlaceDir with each Table has Linked "RefID/Reference ID/First Field of Table Row

1.TblState in Default View and Only has 1 Column and this is the Reference ID + String:
Field Name = State
Data of row1 = State1
Data of row2 = State2
Data of row3 = State3

2.TblCity in Default View and has 2 Columns, the first are RefID and the Second are String :
Field Name = StateID | City
Data of row1 = State1 | City1
Data of row2 = State1 | City2
Data of row3 = State2 | City3
Data of row4 = State2 | City4
Data of row5 = State3 | City5

3.TblZipCode in Default View and has 2 Columns, the first are RefID and the Second are String :
Field Name = CityID | ZipCode
Data of row1 = City1 | 1000
Data of row2 = City2 | 1001
Data of row3 = City3 | 1002
Data of row3 = City4 | 1003
Data of row3 = City5 | 1004

then i'm using Criteria for make this Cascading combobox function Works on Ms.Access

In TblStateDir the Query are = Not Using Query for This
and Query name is QryState

In TblCity the Query are = [Forms]![FrmPlaceDir]![CboState]
and Query name is QryCity

In TblZipCode the Query are = [Forms]![FrmPlaceDir]![CboCity]
and Query name is QryZipCode

Example In Action:

So When i Choose First Cbo/CboState =
- State 1

The Option available in Second Cbo/CboCity are =
- City1
- City2

Also When i'm Select "City1" in the 2nd Cbo/CboCity the Result in 3rd Cbo/CboZipCode are =
- 1000

In Simple Words = I need an VB Combobox via OLEDB which populate it's data when the RefID of each Combobox Source Data/Table are Match with each combobox RefID/Reference ID Row.
Posted
Updated 28-Jun-17 0:24am
v8

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900