Dynamically change design view from within VB code

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
 
B

Brendan Reynolds

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top