string to query in a combo box

A

Afrosheen

I have one combo box called "shift" with a field called locat. I have another
combo box called "assignment". What I want to do is take the calue from the
locat field and have it use that information in the query of the "assignment"
combo box separate the information.
For example: the information in the Shift combo box is"Medical", "Support
Services", and more. The information in the "assignment" box has to do with
the different positions and have a field called "locatt". It has the same
information as the "shift" box. When it matches up with one box it will
display all the information in the "assignment" box. Another example would be
"shift box" Medical. In the assignment box would display everything that had
to do with medical and that's all. Something like Folders and Files. Have
different folders with lots of files that match up and go in that folder.

Since I'm new to programing, I do need help programming. Please advise where
I need to place it.

Thanks for the help. I hope I can reply back. I haven't had much luck with
this.
 
W

Wayne-I-M

This is a called a cassading combo

The source data of the 2nd combo is based of the selection made in the 1st
combo.

You can code this like this
Me.2ndComboName.RowSource = "SELECT RecordID, AnotherField,SomeOtherField
FROM " & " TableName WHERE RecordID = [1stComboBoundColumn]"

There is an easier method
Open the form in design view

Right click the 2nd combo
Open properties box
Select data column
RowSourceType = Table/Query
RowSource - select the build option (...)
Create a new query
Ensure you have the linking field in the query
In the criteria row insert click the build option
Insert the 1st combo from the form like this
Forms![FormName]![1stComboName]

This will filter the 2nd combo based on what you select in the 1st combo

good luck
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top