ComboBox

U

Utopian®

Hello everybody!

I need this precise:

I have 2 Forms, one "initial" and another "Secondary 2"..... In the "initial" there is a ComboBOX (with the code below) in which I choose a "City"... this does that it loaded the "Secondary 2" form just by the data pertaining to the chosen city.


--------------------------------------------------------------------------------

Private Sub choose_AfterUpdate()

DoCmd.OpenForm "Secondary 2", , , "[idCity]=[forms]![initial]![choose]"

End Sub

--------------------------------------------------------------------------------


Now, which I need is: That when choosing this city once, no longer is possibility of returning to choose another one in the next load.

I hope to have been clear, and sorry for my english!!!

Thanks in advance,

Adrian.-
 
S

Steve Schapel

Adrian,

Well, I suppose the Row Source of the Choose combobox is based on a
table where you have all the cities listed... is that right? So you
could add another field to that table, maybe a date/time data type, or
maybe a yes/no data type, and you could update this field when the
selection is made in the combobox, and then use a criteria on this field
to exclude this city from the combobox list for the next selection.
Hope you understand what I mean. But I am not quite sure of your
requirements. After a city is selected, do you mean it should never be
available again? Or just the next selection? Or until the next day?

By the way, your code might be simpler like this...
DoCmd.OpenForm "Secondary 2", , , "[idCity]=" & Me.choose
or...
DoCmd.OpenForm "Secondary 2", , , "[idCity]='" & Me.choose & "'"
(depending on whether idCity is number or text).
 
Top