0

Hey ppl,

I am fairly new to ms access & VBA...

I have a list box and a command box in my form... The list box contains all the car brands like chevrolet, toyota etc.,

I have table with fields ItemName which has all the list of car names (Camry, caprice...) and the category fields which has all the car brand name(Chevrolet, toyota...)

Now when i select a car brand from the list box and select OK command button, I want the list of cars of that brand to be displayed as a report or a form....

eg: When I click Chevrolet I want Camry, Caprice... to be displayed....

I know that this is very simple, but if some one could just start guiding me in the right path it will be good...

Thanks in advance

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by vb5prgrmr
0

Sounds like you are describing a one to many relationship...

tblMake
iMakeID
vMake 'chevy, ford...

tblModel
iModelID
iMakeID 'foreign key
vModel 'F150, F250, ...

So when user selects make, you would then execute...

strSQL = "SELECT iMakeID FROM tblMake WHERE vMake = '" & variableholdingthetextoftheselectediteminlist & "'"
Set Rs = '...
strSQL = "SELECT vModel FROM tblModel WHERE iMakeID = " & Rs.Fields("iMakeID")
Set Rs = '...

Hope you get the gist...

Good Luck

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.