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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.