Change to design view of report in code (1 Viewer)

marathonlady

Registered User.
Local time
Yesterday, 23:43
Joined
Jul 10, 2002
Messages
120
I have to change the report sorts in code depending on what the user selects on the selection form. I also need to change the group footers by using the CreateGroupLevel method. I can't use this unless the report is in design view. Is there a way to change the report to design view in code? Keep in mind when I bring up the filter form for the user to make his sorting selections, I have already opened the report, bringing up the form in the Open_event of the report.

Thanks in advance for any help.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 23:43
Joined
Feb 19, 2002
Messages
43,266
The OpenForm method allows you to open a form in design view.

Hope you're not trying to do this in a multi-user db. Access only allows single user access if objects are being modified.
 

marathonlady

Registered User.
Local time
Yesterday, 23:43
Joined
Jul 10, 2002
Messages
120
What about OpenReport? Does that allow design view?

The report is where I need to make a change that will only allow it in design view. This is not multi-user, so that won't be an issue.

Thanks!
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 23:43
Joined
Feb 19, 2002
Messages
43,266
Hopefully you looked up the answer yourself and are not waiting for me :)
 

marathonlady

Registered User.
Local time
Yesterday, 23:43
Joined
Jul 10, 2002
Messages
120
Now, how do I gracefully close the design view?

I now know how to open the report in design view, change the groupings, but after the report opens up in Preview and the user closes it, what is seen is the report in design view. Of course, I don't want the user to see this. Pat, you must have run into this before?

Any help is appreciated.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 23:43
Joined
Feb 19, 2002
Messages
43,266
Solutions sample db

No I haven't run into the problem because I don't change objects from VBA using that method.

You can probably accomplish the changes you need from within the report's events itself. The solutions database includes a sample report that is made from a dynamic crosstab query. Therefore, each time the report opens, it needs to rebuild all the controls. Examine that sample and I think you will have the answers you need. Here is a link to Solutions:

.Solutions

The problem with changing the report design from "outside" is that you first need to get the report into design view. You may be able to then open the report in some other view without saving it. But then when the user goes to close the report, he'll be prompted to save the changes.
 

Users who are viewing this thread

Top Bottom