Creating report in VB (1 Viewer)

agehoops

Registered User.
Local time
Today, 06:14
Joined
Feb 11, 2006
Messages
351
I'm able to create my report (although it only opens in design view) and i've found the CreateReportControl method to add fields and things I need, but I do I use them both?

Code:
Dim rpt As Report

Set rpt = CreateReport
DoCmd.Restore

That Is the code I'm using to create the report, and I already have it creating the Query, I just now need to add the fields and labels and such.


Thanks
 

Rabbie

Super Moderator
Local time
Today, 06:14
Joined
Jul 10, 2007
Messages
5,906
You will find it much easier to create your report in Design mode and you can position the controls by Eye so you can see how it will look.

Doing it all from VB will take a huge amount of coding to position and size each control exactly where you want it.

Is there a particular reason why you need to create the whole report from scratch each time.
 

agehoops

Registered User.
Local time
Today, 06:14
Joined
Feb 11, 2006
Messages
351
Well i'm making a report in which the user specifies the fields each time from a form, so there is no guarantee which fields are going to be chosen, and WAY too many combinations to create a report for each, so I'm trying to make it create it each time. I can use a template though so I can create one which it fills in I guess.
 

petehilljnr

Registered User.
Local time
Yesterday, 22:14
Joined
Feb 13, 2007
Messages
192
I think also that if your users are using runtime, they won't be able to create a report "on the fly" even through using VB.

You could have a set number of controls on a report template and change the .Caption and .ControlSource properties of the labels and text boxes respectively to the labels and control sources that the user selects when the report is opened?
 

agehoops

Registered User.
Local time
Today, 06:14
Joined
Feb 11, 2006
Messages
351
Oh yea I completely forgot about them not being able to create it. Alright i'll use a template type thing, but would they be able to edit the controls like that in runtime even through VB??
 

petehilljnr

Registered User.
Local time
Yesterday, 22:14
Joined
Feb 13, 2007
Messages
192
Should be ok because the controls are already on the report (i.e. you aren't adding them). You can change their properties in runtime.
 

agehoops

Registered User.
Local time
Today, 06:14
Joined
Feb 11, 2006
Messages
351
Alright cool thanks. I'll take another look at it over the next couple of days and get back to you on here. Thanks for the help :)
 

Users who are viewing this thread

Top Bottom