MS Access (2002) Query/Form Help needed

I’m trying to get a form set up in Access that takes what’s been clicked on in two different drop-boxes, then brings up the corresponding record(s) from the database.

For example, if I have a drop-down box titled ‘Car type’ with ‘compact’ selected, and another drop-down box titled ‘color’ with ‘red’ selected, I want all records that match those to show up in my text area.

The problem is I don’t know how to get the form to do that and I’m not having much luck trying to understand the help file, or tracking down a website with an example for me to look at. (Once I’ve seen how to do it, I can take it from there.)

So, could anyone either tell me how to get this done, or point me at a website that shows how?

Thanks in advance! :slight_smile:


<< Coffee. The 100% natural subsitute for sleep. >>

OK, presumably you have the combo box working OK? - if not, you can use the wizard to get it to display a list of values from a table (usual practice is to get it to display some textual value from a table, but store the value in the corresponding key field for that row, but it is a little hard to explain how to set that up).

The best way to display a set of records is to make a Datasheet form, based on your query, then insert this datasheet form as a subform into the one that has the combo box.

Then edit the query and in the criteria row, use an expression like this:
like Forms![YourFormName]![YourComboName]
or
= Forms![YourFormName]![YourComboName]
(The former code being for the comparison of textual data, the latter numeric)

Then in the OnChange event of your combo box, insert the instruction:
Me.YourSubFromeName.Requery

I got the boxes working right: they’re grabbing the possible values to choose from, from the existing tables.

Ahh, so that’s the syntax… I’ll have to poke around with the database tomorrow (I’ve since headed home from work) and see how it goes.

Thanks!

Here is a very quick and dirty example of how it can be done - it is in A97, but it may be possible to import this into A2002.

Oooo! Thank you ever so much Mangetout: having a nice example to fiddle around with a tweak makes it much easier to figure out.

sends Mangetout some Christmas cookies and the like