Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 3rd, 2006, 01:14 PM
Authorized User
 
Join Date: May 2006
Location: Elk Grove, CA, USA.
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default Combo box select affecting avail option in another

I am wanting to select an option from one combo box and then have it change the available options in another combo box?

I have created three tables Companies, Employees, and Issue.
In all three tables I have added CompanyID as a common factor.
In the Employees table I have a field called Name.
In the Issue table I have created combo box field called company name where the source is the companyname field from the companies table . In the same table I have created a combo box field called contact whereas the source is the Name field from the employees table.
What I am trying to do is create a form from the Issue table where the Company Name field and Contact field are inserted in the form however, when I select a company from the dropdown in form view of the issues table the contacts field will have a dropdown only showing me the contact from that particular company only that I can select from.
Can anyone help me with coding this? I am trying to do an SQL query an here is what I have maybe I am wrong.

Select Name
From Employees
Where Companies.companyid = Employees.companyid

I have to be missing something because it is not working. =(


EB


EB
__________________
EB
  #2 (permalink)  
Old June 3rd, 2006, 01:22 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Here is what I have done in the past...

Combo 1 is the first one you would select from.

On the OnClick event for Combo 1 have it do Combo2.Requery

For Combo 2, have the record source as a SQL Statement, but with a WHERE clause that references Combo 1.

Below is an example of 1 I did a while back.

SELECT tblSubData.SubData, tblSubData.SubDataID, tblSubData.SubDataParent FROM tblSubData INNER JOIN tblData ON tblSubData.SubDataParent = tblData.DataID WHERE (((tblSubData.SubDataParent)=[cboCombo1].[Value])) ORDER BY tblSubData.SubData;

Hope that helps - If not yell!

Mike
EchoVue.com
  #3 (permalink)  
Old June 3rd, 2006, 03:22 PM
Authorized User
 
Join Date: May 2006
Location: Elk Grove, CA, USA.
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I will try that and get back to you.

thank you

eb

EB
  #4 (permalink)  
Old June 3rd, 2006, 04:33 PM
Authorized User
 
Join Date: May 2006
Location: Elk Grove, CA, USA.
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, once again you have saved the day. That worked. =)

EB
  #5 (permalink)  
Old June 3rd, 2006, 05:33 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Good to hear!!

Mike
EchoVue.com


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo Box to Show Multi Column Info After Select Coby Excel VBA 0 August 14th, 2007 05:23 PM
option selected from a select box Adam H-W Classic ASP Basics 3 December 11th, 2006 11:09 AM
Select-As-You-Type Combo box? eruditus Classic ASP Components 0 May 4th, 2006 08:42 AM
dynamic upload a combo box from database on select rashmisrao JSP Basics 4 February 27th, 2006 08:41 AM
Multi Select Combo Box acdsky VB How-To 2 March 1st, 2004 03:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.