Dynamically change design view from within VB code

  • Thread starter Thread starter Jack
  • Start date Start date
J

Jack

Hi,

Is there a way to dynamically modify the design view of a form, query and
report from within Access VB code? How? I would like to add and/or modify
controls/fields in them according to records in a table that can be linked
from a different database each time the program is run. In other words, the
layout of the form/query/report would be specified by the records in those
tables.

Thank you for your help,

Jack
 
The query is easy - just modify the SQL property of the DAO.QueryDef object.
The form and report, however, are ugly. You have to open them in design
view, and use the CreateControl or CreateReportControl methods to create the
control. This won't work in an MDE, using the runtime version of Access, or
in a secured MDB where the user does not have modify design permission.

It's easier to create as many controls as you need at design time, and just
set the properties of the controls (Visible, ControlSource, etc.) at run
time.
 
Back
Top