I am extending an existing Access/VBA app and need to update a subform
displayed in continuous view within a containing form. The existing
form and subform have worked fine to date with the subform's
RecordSource set to an underlying DB table.
To extend the existing app, I need to add controls to the subform and
set their Text values etcetera at runtime. (Clearly if a single
RecordSource would do the trick, I would extend the underlying table
and bind its new fields to the subform's new controls, but that's not
an option here.) I thought the subform's initialization or loading
subroutines would be natural places for code to set the subform's
controls' properties. However, this approach produces an error
stating that I cannot access a control's properties or methods while
it doesn't have the focus.
Obviously assigning values to controls' properties in its form's
initialization, loading, or opening code can work. There are forms in
VB(A) apps before me with this sort of code, and it works just fine.
(...open to the suggestion this isn't ideal, though.) Does anyone
know why this approach doesn't seem to work in a form's code when the
form is a subform? (Note that I _am_not_ trying to assign values to
the subform's controls in its _containing_ form's code.)
Thanks, y'all! I hope someone out there can cut through my confusion,
because I really need an informed VB programmer's help right now! :-)
Joe Egan