Dynamic adding controls to a report.

E

Ebbe

Hey everyone, and Mary Christmas!

I wish to make a report, an overview over participants to some activities.
Each row is a person and columns are activities.
The number of activities varies an there is not a maximum.

Is it possible to place controls (in this example textbox with information
and label/header) using VBA without having defining them beforehand?

If so, how?

Ebbe
 
A

Arvin Meyer

In your help file, look up CreateReportControl function and the
CreateControl function in the Microsoft Access Visual Basic Reference under
Methods. There are examples and constants for specific design. You may want
to take an easier approach and create them before-hand, then set their
Visible Property to false. At runtime, all you need to do is set the control
visible, and possibly change a controlsource. That will make the code run
much faster and present fewer possibilities for problems.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
W

Wayne Morgan

Basically, no.

You can predefine controls and hide/unhide them. However, it sounds as if
you need a report/sub report setup. The participants would be listed in the
report with a subreport printing the activities for each participant. This
won't limit you to any particular number of activities. Of course, your
tables will also need to be set up appropriately for this.
 
E

Ebbe

Thank You Arvin!
I think i can magane it from here.

I have an additional question, I hope You can answer.
It is about creating a query to feed the report.

I have 3 tables with persons, activitis and bookings.

tblPerson:
strPerName;strGroup
John;Th
Kenn;Th
Mary;Th
Nya;Hy

tblActivity:
strActName
Kodes
Nature
Fire
Tools
Movement

tblBooking:
strPerName;strActName
John;Kodes
John;Tools
Kenn;Nature
Kenn;Tools
Mary;Kodes
Mary;Nature
Nya;Movement
Nya;Fire

I wich query returning:
qryOverview:
strPerName;Kodes;Nature;Fire;Tools;Movement
John;1;;;1;
Kenn;;1;;1;
Mary;1;1;;;
Nya;;;1;;1

I thought of something like a pivot-query, if it exists

Ebbe
 
J

Jeff Boyce

Ebbe

If this is related to your later post about querying your data, you may not
need to have dynamic creation of controls in forms or reports, if your data
is well-normalized. (See my response to your later post in this 'group.)
 

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