Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to add dynamic report controls using a basic report? 1

Status
Not open for further replies.

inso18

Technical User
Dec 30, 2006
147
IL
Hello.

I have a basic report which has constant basic properties in it: Header, recordSource, box controls and other graphics which I do not want to create each time again, called rptBasicReport.

I need to be able to create reports which will be based on this basic report but will add more stuff to it, or will change some of its controls.

I know how to create a new report from scratch using the methods CreateReport, and CreateControl for each field:

Code:
dim rpt as Report
set rpt = CreateReport
rpt.RecordSource = strSQL
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
For Each field In rs.fields
    set ctl = CreateControl(rpt.Name .....
Next

As mentioned earlier, I don't need to create a new report from scratch, but to be able to add more control to already existing report which is called rptBasicReport.

I see that there Report_rptBasicReport class in my access classes.

Can I use somehow
Code:
dim rpt as Report_rptBasicReport
?
Is there some other way to add controls to already existing report?
Maybe there's a way to get the underlying code of the creation of rptBasicReport - graphics and etc, and then to create a new report using them?

Can you help?
Thanks a lot.
 
it is not a good idea to have reports where you are dynamically generating controls. I strongly advise to think of another soution.
Why do you need to do it this way? There might be a better solution.

Describe your data structure and report needs.

.....
I'd rather be surfing
 
I agree with jordanking. This is a highly unusual need. If you truly need more controls, I would add extra invisible text boxes and then set their properties at run time.

Duane MS Access MVP
 
My needs are user configurable question styles and formulas, and their quantity (number of questions):

Report1

Question1: ................ [Mark]
Question2: ................ [Mark2]
Question3: ................ [Mark3]

Thanks
 
IMHO, each question should be a record in a table, not a field. I invision 3 records in your above sample.

Duane MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top