Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old May 21st, 2008, 09:24 AM
apgriffiths apgriffiths is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 10 apgriffiths User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 11 m 47 sec
Reputation Power: 0
Forms - Using 2 combo boxes in conjunction with each other

I have a form that gets all of its data from a query. The form is to be used for querying records only not inputting new records. The data in this database is for looking at courier delivery routes on certain dates.

I want to have two combo boxes. The first one will have a list of available dates. I have created this box. I then want a second box that lists all of the routes that were done on that day. This means that the second combo box is driven by the date selected in the first. I then have a number of text boxes on the form that should be populated from the date and route number that have been selected in the combo boxes.

Any help would be much appreciated.

Reply With Quote
  #2  
Old May 21st, 2008, 09:42 AM
ibgreat ibgreat is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 86 ibgreat User rank is Sergeant (500 - 2000 Reputation Level)ibgreat User rank is Sergeant (500 - 2000 Reputation Level)ibgreat User rank is Sergeant (500 - 2000 Reputation Level)ibgreat User rank is Sergeant (500 - 2000 Reputation Level)ibgreat User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 6 h 51 m 28 sec
Reputation Power: 11
You want to create a cascading combo box. I'm a visual learner and this link made it simpler than trying to explain.

http://datapigtechnologies.com/flashfiles/combobox2.html
Comments on this post
sbenj69 agrees: good to see that the sticky I posted actually helped someone

Reply With Quote
  #3  
Old May 21st, 2008, 10:19 AM
sbenj69's Avatar
sbenj69 sbenj69 is offline
Redneck 'puter fell'r
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2007
Location: Redneck part of Illinois
Posts: 1,722 sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)  Folding Points: 305646 Folding Title: Super Ultimate Folder - Level 1Folding Points: 305646 Folding Title: Super Ultimate Folder - Level 1Folding Points: 305646 Folding Title: Super Ultimate Folder - Level 1Folding Points: 305646 Folding Title: Super Ultimate Folder - Level 1Folding Points: 305646 Folding Title: Super Ultimate Folder - Level 1Folding Points: 305646 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Weeks 1 Day 13 h 17 m 38 sec
Reputation Power: 1460
If you want a working example, you can go >>HERE<<
There are 2 samples linked to that thread.
__________________
Did I help you? If so gimme rep by clicking on the scales at the top right corner of this post

Madness does not always howl. Sometimes, it is the quiet voice at the end of the day saying, "Hey, is there room in your head for one more?"

Reply With Quote
  #4  
Old May 21st, 2008, 10:25 AM
apgriffiths apgriffiths is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 10 apgriffiths User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 11 m 47 sec
Reputation Power: 0
Thanks for the link but im having trouble still. The query builder for the row source will not accept the criteria statement.

I am entering [forms]![frmName].[cmbDate]

I then get an error saying the database engine does not recognise [forms]![frmName].[cmbDate] as a valid field name or expression.

I am using access 2007 if this makes a difference.

Reply With Quote
  #5  
Old May 21st, 2008, 10:38 AM
ibgreat ibgreat is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 86 ibgreat User rank is Sergeant (500 - 2000 Reputation Level)ibgreat User rank is Sergeant (500 - 2000 Reputation Level)ibgreat User rank is Sergeant (500 - 2000 Reputation Level)ibgreat User rank is Sergeant (500 - 2000 Reputation Level)ibgreat User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 6 h 51 m 28 sec
Reputation Power: 11
In your expression you refer to your form name as [frmname] and your combo bx as [cmbDate]. Did you use your forms actual name? I assume you changed the combo boxe's name to cmbDate.

Reply With Quote
  #6  
Old May 21st, 2008, 10:49 AM
apgriffiths apgriffiths is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 10 apgriffiths User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 11 m 47 sec
Reputation Power: 0
Yes, i changed the combo box name to [cmbDate] and the form is actually called [Dartford_Week_Summary].

I have just tried it using the expression builder and it came out slightly different,

[Forms![Dartford_Week_Summary]![cmbDate]

It still didnt work though

Reply With Quote
  #7  
Old May 21st, 2008, 11:32 AM
ibgreat ibgreat is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 86 ibgreat User rank is Sergeant (500 - 2000 Reputation Level)ibgreat User rank is Sergeant (500 - 2000 Reputation Level)ibgreat User rank is Sergeant (500 - 2000 Reputation Level)ibgreat User rank is Sergeant (500 - 2000 Reputation Level)ibgreat User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 6 h 51 m 28 sec
Reputation Power: 11
The expression you just sent did not have the end bracket at the end of the [forms] expression. Cut and paste your expressions to avoid typos. Are you still getting the error message or is it just not working.

I don't think the . vs ! really matters as long as "!" is between the [forms] and [form name]. I typically use the "!" before forms and "." elsewhere.Someone else can better explain the exact syntax differences.

When you were in Query builder, for the column you are referencing to the parent did you add the Where statement. Also, be sure you are using the Key in the field.

Lastly, did you add the afterupdate procedure to the parent combo box. That should get the combo boxes working.

Reply With Quote
  #8  
Old May 21st, 2008, 11:55 AM
sbenj69's Avatar
sbenj69 sbenj69 is offline
Redneck 'puter fell'r
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2007
Location: Redneck part of Illinois
Posts: 1,722 sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)sbenj69 User rank is General 7th Grade (Above 100000 Reputation Level)  Folding Points: 305646 Folding Title: Super Ultimate Folder - Level 1Folding Points: 305646 Folding Title: Super Ultimate Folder - Level 1Folding Points: 305646 Folding Title: Super Ultimate Folder - Level 1Folding Points: 305646 Folding Title: Super Ultimate Folder - Level 1Folding Points: 305646 Folding Title: Super Ultimate Folder - Level 1Folding Points: 305646 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Weeks 1 Day 13 h 17 m 38 sec
Reputation Power: 1460
make sure to requery any sub-comboboxes (so to speak) on the afterupdate event of the combobox. Say you have 2 combo-boxes, cbo1 and cbo2 and they both reside in form1.... on the afterupdate event of cbo1, you would build a vba function to requery cbo2. Forms!Form1.cbo2.Requery

Now, for the query that cbo2 uses, you will want to put this in the criteria of the field that cbo1 controls. Forms!form1.cbo1

Keep in mind that the table that cbo2 is built off of, has to have the data that cbo1 has.

For instance cbo1 is based on table1, and cbo2 is based on table2....

Table1 (Data - not fields)
North
South

Table2 has to have north and south in the records for the cascading comboboxes to work.

Table2 (This is data, not the fields)
North Boston
North Chicago
North Seattle
South Atlanta
South Dallas
South Reno

If cbo1 was chosen to be north, then cbo2 would equal Boston, Chicago, Seattle
If cbo1 was chosen to be south, then cbo2 would equal Atlanta, Dallas, Reno

Both comboboxes can be based on the same table too.
Comments on this post
ibgreat agrees: Exactly!, this is what the datapig link exemplified

Last edited by sbenj69 : May 21st, 2008 at 12:00 PM.

Reply With Quote
  #9  
Old May 22nd, 2008, 05:47 AM
apgriffiths apgriffiths is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 10 apgriffiths User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 11 m 47 sec
Reputation Power: 0
Thanks Guys. Ive now got it working.

Cheers

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Forms - Using 2 combo boxes in conjunction with each other


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT