|
From: Art Vandaley on 7 Jul 2008 16:10 Access 2007. Hi Everybody, I have a table with 10 fields. First combo box is enabling selection of field lists of the table. I want second combo box to show data of related field of th table according to the selection of first combo box. I try below code: If combo1.value="field1" then combo2.rowsourcetype="Table/Query" combo2.rowsource="table1" (I just want to have field1's data to be shown by combo2) else if combo1.value="field2" then combo2........... .. .. .. .. What should I do in order to get related field's data? Help please. Regards.
From: Douglas J. Steele on 7 Jul 2008 16:51 No need to bother checking what the value is. Just use Me.combo2.rowsourcetype = "Table/Query" Me.combo2.rowsource = "SELECT DISTINCT [" & combo1.value & "] " & _ "FROM table1 ORDER BY 1" -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Art Vandaley" <kestafir(a)hotmail.com> wrote in message news:%23Z3xi2G4IHA.2064(a)TK2MSFTNGP02.phx.gbl... > Access 2007. > > Hi Everybody, > > I have a table with 10 fields. First combo box is enabling selection of > field lists of the table. I want second combo box to show data of related > field of th table according to the selection of first combo box. I try > below code: > > If combo1.value="field1" then > combo2.rowsourcetype="Table/Query" > combo2.rowsource="table1" (I just want to have field1's data to be > shown by combo2) > > else if combo1.value="field2" then > combo2........... > . > . > . > . > What should I do in order to get related field's data? > Help please. Regards. >
|
Pages: 1 Prev: Getting error: ‘Object or class does not support the set of ev Next: Query with parameters |