PC Review


Reply
Thread Tools Rate Thread

2 comboboxes on a form

 
 
geert.van.ransbeeck@telenet.be
Guest
Posts: n/a
 
      28th Oct 2008
Hello

I want to have 2 combo boxes on my form.
The first one contains a series of account managers. (No problem; I
used an SQL-statement on the Row source and tere they are).

The second has to contain a list of their clients. So when I select
another account manager in the first combobox, automatically only
their corresponding clients have to disappear in the second combo box.
Can someone help me please how I have to proceed?
 
Reply With Quote
 
 
 
 
Alex Dybenko
Guest
Posts: n/a
 
      28th Oct 2008
Hi,
have a look here:
http://www.mvps.org/access/forms/frm0028.htm

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com


<(E-Mail Removed)> wrote in message
news:06f989cc-a02e-41c8-a312-(E-Mail Removed)...
> Hello
>
> I want to have 2 combo boxes on my form.
> The first one contains a series of account managers. (No problem; I
> used an SQL-statement on the Row source and tere they are).
>
> The second has to contain a list of their clients. So when I select
> another account manager in the first combobox, automatically only
> their corresponding clients have to disappear in the second combo box.
> Can someone help me please how I have to proceed?


 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      28th Oct 2008
In the AfterUpdate event of the first combo box, modify the SQL for the
second combo box's RecordSource:

Private Sub Combo1_AfterUpdate()

Me.Combo2.RecordSource = "SELECT Field1, Field2 " & _
"FROM Table2 " & _
"WHERE Field3 = " & Me.Combo1

End Sub

Alternatively, have the RecordSource for the second combo refer to the first
combo:

SELECT Field1, Field2
FROM Table2
WHERE Field3 = Forms!NameOfForm!Combo1

and just requery the second combo in the AfterUpdate event of the first
combo:

Private Sub Combo1_AfterUpdate()

Me.Combo2.Requery

End Sub

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


<(E-Mail Removed)> wrote in message
news:06f989cc-a02e-41c8-a312-(E-Mail Removed)...
> Hello
>
> I want to have 2 combo boxes on my form.
> The first one contains a series of account managers. (No problem; I
> used an SQL-statement on the Row source and tere they are).
>
> The second has to contain a list of their clients. So when I select
> another account manager in the first combobox, automatically only
> their corresponding clients have to disappear in the second combo box.
> Can someone help me please how I have to proceed?



 
Reply With Quote
 
 
 
Reply

Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Form creation with 6 comboboxes Shiva Microsoft Access Forms 3 17th Jul 2008 04:37 PM
Comboboxes in a form PK.10987 Microsoft Access 2 4th Jun 2008 10:12 AM
Getting Comboboxes and Textboxes from Form Werner Wopienka Microsoft Dot NET Compact Framework 1 10th Feb 2005 01:31 PM
Clearing all comboboxes on a form UgetSpam Microsoft Access Forms 3 26th Nov 2003 01:15 AM
Sycronizing two comboboxes and a sub form Erik Gjertsen Microsoft Access Forms 0 11th Aug 2003 04:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:58 PM.