Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Bound Columns in a ComboBox?

Status
Not open for further replies.

Accesser

Technical User
Jun 3, 2002
44
0
0
US
Hello,

I have 2 tables joined in a query. In a combobox on a form, users must view columns from both tables—I can set this up. The combobox’s control value is currently set to the ID of one of the tables (ChemID). However, the ID is NOT a unique ID in the table (a join table). What will make the combo selection unique is the combination of IDs from both tables.

So, I need a way of being able to select the combination of IDs, but have the ChemID that corresponds to the right VolID still be filled in for the combobox’s value. The following is possible:

CHEMICAL ID VOLUME ID
3 3
3 4
3 7

Right now, when a user selects ChemID 3 and VolID 7, the combobox reverts back to the original ChemID 3 and VolID 3.

Is there a way to solve this?

Thanks.
 
make a query like this

SELECT Table2.[field 1], Table2.[field 2], Str([field 1]) & Str([field 2]) AS together
FROM Table2;

the together field is unique and should be saved in your other table "What a wonderfull world" - Louis armstrong
 
Set your SQL to something like this:

Select ChemID, VolID From etc.
Order by ChemID, VolID;

Then in the combobox properties, set field widths to x, y and the bound column to 2. Or if you need to see both together as one do something like the following. If they are numeric you may need to use the Str function to convert them to string.

Select VolID, ChemID & " " & VolID from etc.
Order By 2 '<= you can use column ordinal number in stead

Now set column widths to 0, x '<= will hide the first one
and bound column to 1

Good Luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top