By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,221 Members | 1,106 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,221 IT Pros & Developers. It's quick & easy.

Excluding Previously selected Combo Box record to current Combo Box

P: n/a
I have a form for transfers, which has on it 2 combo boxes, each with the
same list of locations in them. I want combo box 2 to include all the
locations apart from the one selected in combo box 1. E.g. A user can't
transfer something from NY to NY. Can anyone suggest how I do this?

Thanks in advance
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Will, just exclude the value in your combobox (cbo1) from the result
set of your query for combobox2. Something like this: (tblRowSource)
is whatever your current query is.

SELECT ....
FROM tblRowSource
WHERE ...
AND tblRowSource.Field<>Forms!MyForm!cbo1

Nov 13 '05 #2

P: n/a
Rog
Let's say you have a table called tblLocations with field fldLocation.
Populate it with all your locations.

Your form, let's call it yourform, has comboboxes cboFrom and cboTo.
Rowsource for cboFrom is "Select fldLocation from tblLocation order by
fldLocation".
Rowsource for cboTo is "Select fldLocation from tblLocation where
fldLocation <> forms!yourform!cboFrom order by fldLocation".

In the after update event of cboFrom, type Me!cboTo.Requery.

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.