ch***************@charter.net wrote:
I am trying to set a combo box to list the fields in one of my tables.
I am using the code
Dim MyControl As Control
Set MyControl = Forms![Form1]![Combo2]
MyControl.RowSourceType = "Field List"
MyControl.RowSource = "tlbMedications"
MyControl.Value = MyControl.ItemData(0)
The problem I (a pure novice) am having is that I can't figure out
where to stick the procedure in which the code would reside. Should
it be tied to an event on the form, or a standard procedure, or
what???
Why are you setting it with code? Is it sometimes displaying a different
RowSource? If the RowSource is dynamic then what EVENT triggers the change?
Once per form instance? Once per record? The former would make the Open or
Load event of the form the appropriate place to run the code. The latter would
make the form's Current event the most appropriate place. You need to provide
more details about your needs and expectations.
If the list is not dynamic then you shouldn't use code at all, but just set the
properties for the list in form design view and be done with it.
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com