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

Home Posts Topics Members FAQ

need help with cascading combo/list boxes

18 New Member
Hey i need help with setting up this on ACCESS 2007
i need step by step

i need a form...
i select a name (drop list)...then gives me more choice (in next drop list) ....then when i select that choice give another list (drop list)..

so for example
i select canada, from list of contries, then i would get list of the provinces and then i choose my province and then i get list of cities

if someone let me know step by step how to do that i would appericiate it.
Aug 15 '07 #1
26 4824
Rabbit
12,516 Recognized Expert Moderator MVP
You have posted in the wrong forum, I am moving this post the the appropriate forum.

Please use a clearer title next time. I will change it for you this time.
Aug 15 '07 #2
Rabbit
12,516 Recognized Expert Moderator MVP
Take a look at the Cascading Combo/List Box Tutorial.
Aug 15 '07 #3
pouj
18 New Member
thank you so much you saved my life!!!!! also i didnt know it was called cascading combo box.
Aug 15 '07 #4
Rabbit
12,516 Recognized Expert Moderator MVP
thank you so much you saved my life!!!!! also i didnt know it was called cascading combo box.
You don't have to know what it's called but the title should be descriptive of the question.
Aug 15 '07 #5
pouj
18 New Member
okay so i read over cascading combo/list boxes tutorial and my projct doesnt work.

i will tell you exactly what i have done...

my first table called tblcontractor..
has 2 field
ID: Automatic
ContractorIDNum ber: Number (which gets its data from another table)

my next table called tblcontractorpr oject
has 3 fields
ID: autonumber
Contractorproje ctname: text
contractoridnum ber: Number (which gets i data from same table that tblcontracot contractoridnum ber gets it data)

then i create a form and then form i drop the the tables in there..and i went to properties and i went to afterupdate and i put in [Event Procedure] and i went to VB editor and i type this in there...
Expand|Select|Wrap|Line Numbers
  1. Private Sub ContractorIDNumber_AfterUpdate()
  2. With Me![ContractorIDNumber]
  3. If IsNull(Me!ContractorIDNumber) Then
  4. .RowSource = ""
  5. Else
  6. .RowSource = "SELECT [Contractorprojectname] " & _
  7. "FROM Tblcontractproject " & _
  8. "WHERE [ID]=" & Me!ContractorIDNumber
  9. End If
  10. Call .Requery
  11. End With
  12. End Sub
  13.  
also keep in mind that i have no data in the tables yet. so if you tell me what i am doing wrong here, i would apperciate it.
Aug 15 '07 #6
Rabbit
12,516 Recognized Expert Moderator MVP
okay so i read over cascading combo/list boxes tutorial and my projct doesnt work.

i will tell you exactly what i have done...

my first table called tblcontractor..
has 2 field
ID: Automatic
ContractorIDNum ber: Number (which gets its data from another table)

my next table called tblcontractorpr oject
has 3 fields
ID: autonumber
Contractorproje ctname: text
contractoridnum ber: Number (which gets i data from same table that tblcontracot contractoridnum ber gets it data)

then i create a form and then form i drop the the tables in there..and i went to properties and i went to afterupdate and i put in [Event Procedure] and i went to VB editor and i type this in there...

Private Sub ContractorIDNum ber_AfterUpdate ()
With Me![ContractorIDNum ber]
If IsNull(Me!Contr actorIDNumber) Then
.RowSource = ""
Else
.RowSource = "SELECT [Contractorproje ctname] " & _
"FROM Tblcontractproj ect " & _
"WHERE [ID]=" & Me!ContractorID Number
End If
Call .Requery
End With
End Sub

also keep in mind that i have no data in the tables yet. so if you tell me what i am doing wrong here, i would apperciate it.
When you're doing a cascading combo box you use more than 1 combo box. You're only using one combo box here. Read the tutorial more closely.

You're also attempting to return records based what looks to be a primary key when you should be using a foreign key.
Aug 15 '07 #7
pouj
18 New Member
When you're doing a cascading combo box you use more than 1 combo box. You're only using one combo box here. Read the tutorial more closely.

You're also attempting to return records based what looks to be a primary key when you should be using a foreign key.
how do i use foreign key....and i am using 2 combo box.
Aug 15 '07 #8
Rabbit
12,516 Recognized Expert Moderator MVP
how do i use foreign key....and i am using 2 combo box.
But your code is only using one combo box.

You use a foreign key by using the foreign key field's name instead of the primary key field's name.
Aug 15 '07 #9
pouj
18 New Member
okay...so now my code looks like this....
Expand|Select|Wrap|Line Numbers
  1. Private Sub cpyname_AfterUpdate()
  2.     With Me![Employee]
  3.         If IsNull(Me!company) Then
  4.             .RowSource = ""
  5.         Else
  6.             .RowSource = "select [empname] " & _
  7.             "from tblemployees " & _
  8.             "where [id] =" & Me!company
  9.         End If
  10.         Call .Requery
  11.         End With
  12. End Sub
  13.  
but i am getting debug on With Me![Employee]...so what i am suppose to do there...and also...like i tried to set up FK but it doesnt work (thats what i am assuming) because in relationship field i just get a line from ID to EID..and can you refresh my head with the steps on how to set up FK keys? or i am doing it right...
Aug 15 '07 #10

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

Similar topics

2
3328
by: Cameron | last post by:
Hi, For the database I am currently working on, my employer would like the ability to use multiple combo boxes in order to filter the database. For instance the structure of the company is based on regions, which are managed by a number of coordinators, who oversee a large group of associates. I would like to use a combo box so that people accessing the database can choose a particular region and then have a second combo box that only...
6
2086
by: visionstate | last post by:
Hi there, I am building a database that requires cascading lists on a form. I currently have (I may be adding more later) 3 combo boxes on my form - Department, Surname and Forename. The user chooses the department they want and then the corresponding surnames from that department can be chosen from the Surname box and then the Forename depending on which Surname they chose. I then have a command button which produces the results of the...
2
3268
by: Dave | last post by:
I have 3 tables of information feeding into 4 combo boxes on my main form (DR Form). I have as many list boxes (acting as text boxes) as there are fields in each one of the 3 tables. Once selecting from the combo box, I have all the combo boxes, using afterupdate, populating their respective list boxes. These text boxes are directly correlated to the combo box selection using SQL. Here is an example from the afterupdate event in the...
1
2674
kcdoell
by: kcdoell | last post by:
Good Morning: I have a form where I am trying to create cascading combo boxes. I have done this before but I am getting the following error that is throwing me off: Procedure declaration does not match description of event or procedure having the same name. Basically have three tables: One for the Division location:
11
3059
by: jgoodnight | last post by:
Hi, I have a form with three combo boxes: Area, Sub-Area, and Factor. I've set up the Sub-Area combo box to list only those areas that are part of the selected area. I've set up the Factor combo box to list only those factors that are part of the selected sub-area. For example, if I select area 1.0, the Sub-Area combo box displays 1.1, 1.2, and 1.3 as options. It does not show 2.1, 3.1, etc. If I select area 2.0, the Sub-Area combo box...
12
1728
by: azalea45 | last post by:
Hi all I am a newbie when it comes to access. My company requires that all Databases run on the company SQL back-end as a result i have a Access project that connects to the server. I have two tables, table 1 called tblProjectDetails, table 2 called tblLearners The fields in tblProjectDetails are ProjectPK numeric (Its also the Primary Key)] Name char (50) Description char (50) There are other field but they dont play a role in the...
7
5840
by: Toireasa | last post by:
Hi, Newbie Access developer here, and my first post on this forum, so I might not get everything right - thanks in advance for your help and your patience! I'm using Access 2007, in XP. I'm currently trying to set up a whole pile of cascading combo boxes of different levels of complexity, so I started with the easiest set - and can't even get that to work (even using the tutorial on this site at...
3
1498
by: buddyr | last post by:
Hello, I was able to use the example on Cascading /List boxes on the site here for 2 combo boxes. http://bytes.com/topic/access/insights/605958-cascading-combo-list-boxes Is there a way to add another combo box that is based on how 2nd combo box is filled and still use this code. If you could explain it in relation to this example- If when I select an employee- I have another combo box named 'State'- that shows different states each...
3
1479
by: Outback | last post by:
Hi. Windows XP + Access 2002. I have three tables. tblMakes ======= MakeKey (PK) Make tblModels
0
9647
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9489
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
10356
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...
0
8988
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
7509
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
5396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2893
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.