Dependant Pulldowns (New-B help)

  • Thread starter Thread starter Addammer
  • Start date Start date
A

Addammer

First,
I am brand new to Access 2003 and programming. Please use basic terms.

Second,
I am trying to create a form where, when you select an item from one
pulldown the pulldown below is populated depending on what you selected
in the previous one. I have googled this, and have found some sources,
but they were a tad confusing to me. Do you guys have any good
resources for something like this, or an easier way to explain it?
www.autotrader.com under "Find Your Car" is a perfect example of what
I want to do (but my application is not online)

Thanks!
Adam
 
First,
I am brand new to Access 2003 and programming. Please use basic terms.

Second,
I am trying to create a form where, when you select an item from one
pulldown the pulldown below is populated depending on what you selected
in the previous one. I have googled this, and have found some sources,
but they were a tad confusing to me. Do you guys have any good
resources for something like this, or an easier way to explain it?
www.autotrader.com under "Find Your Car" is a perfect example of what
I want to do (but my application is not online)

Thanks!
Adam

In your combo box's After Update event, something like:

If Me.cboCombo1 = whatever1 Then
Me.cboCombo2.RecordSource = "qryMyQuery1"
ElseIf Me.cboCombo1 = whatever2 Then
Me.cboCombo2.RecordSource = "qryMyQuery2"

and so on. You could probably code the query names into one of the combo's
hidden columns I suppose but that's getting a bit more advanced.

HTH - Keith.
www.keithwilby.com
 
Hi,

I have only just learnt this myself!!

First thing to do is create two tables.

The first table has one field: "CarMake"

Ford
Toyota

maybe called it "CarMake"

The second table has two fields: "CarMake" and "Model" but ID is multiple

Ford Mustang
Ford Thunderbird

and repeat this for every model and make. Call it "CarModel"

In the form have two combo boxes.

In the rowsource of "CarMake" put this

SELECT [CarMake].[CarMake] FROM Carmake;

In the after update event, click on the white line and go to the right and
press "..." and the code box will come up. Put in the following

Private Sub carmake_AfterUpdate()

Me.carmodel.Requery

End Sub

In the rowsource for the second combo box put the following:

SELECT [carmodel].[model] FROM carmodel WHERE
((([carmodel].[make])=[Forms]![Form1]![make]));

(Which basically says select the choice of models depending on what the make
is; "Form1" is the name of the form).

That should work (but isn't easy to explain!)
 
WOW, Thank you isn't enough!

Do you guys know if there is a way to do this with all the information
being stored in just one table?

I.E. CarModel and CarMake would be in the same table.

Thanks
 
I think I may have got a bit of the rowsource code wrong but I think you
should be able to understand the referencing well enough for it to work.

It is possible to include both columns in one table/query. If you call the
source "Car"
and call the two columns "make" and "model" then the first rowsource would be

SELECT [Car].[Make] FROM Car;

The second rowsource would be:

SELECT [car].[model] FROM car WHERE
((([carmodel].[make])=[Forms]![Form1]![make]));

I think that should work. Remember to change the [event procedure] to
reflect this.
 
Back
Top