Problems with opening reports in Acccess 2003 H-e-e-e-e-lp!!!!!!!

  • Thread starter Thread starter Nathan
  • Start date Start date
N

Nathan

Okay, so I start Access 2k3, open the appropriate folder, and then DB. When
I open any report, it comes up in a small window that is ~ 25% - 33% of a
full window and the report maginification is in "fit" mode. When opening
reports, how do I get them to come up in a maximized window at 100%
magnification without having to max. the window and change the magnification
each time I open one?

While I'm at it, I have set up several DB's in Access 2k, on a diferent
computer. How do I get rid of the security warning that suggests a "macro
virus"? Can I do this without having purchase additional software?
 
In line:

Nathan said:
Okay, so I start Access 2k3, open the appropriate folder, and then DB. When
I open any report, it comes up in a small window that is ~ 25% - 33% of a
full window and the report maginification is in "fit" mode. When opening
reports, how do I get them to come up in a maximized window at 100%
magnification without having to max. the window and change the magnification
each time I open one?

Something like this ourght to do it:

Private Sub cmdPreview_Click()
DoCmd.OpenReport "YourReportNameHere", acViewPreview
DoCmd.RunCommand acCmdZoom100
End Sub
While I'm at it, I have set up several DB's in Access 2k, on a diferent
computer. How do I get rid of the security warning that suggests a "macro
virus"? Can I do this without having purchase additional software?

Tools ... Macro ... Security ... Low (Not Recommended)

The Not Recommended is by Microsoft.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access Downloads
http://www.datastrat.com
http://www.mvps.org/access
 
in message:
Okay, so I start Access 2k3, open the appropriate folder, and then DB. When
I open any report, it comes up in a small window that is ~ 25% - 33% of a
full window and the report magnification is in "fit" mode. When opening
reports, how do I get them to come up in a maximized window at 100%
magnification without having to max. the window and change the magnification
each time I open one?

While I'm at it, I have set up several DB's in Access 2k, on a different
computer. How do I get rid of the security warning that suggests a "macro
virus"? Can I do this without having purchase additional software?

Arvin has you covered just fine, but in case you would like some additional
information on the new macro security feature, here is some stuff I have compiled:

You can to go Tools, Macro, Security and set it to low.
If the security item isn't on that menu, you may need to reset your menubar. See:
http://support.microsoft.com/default.aspx?scid=kb;en-us;833219&Product=acc2003

You can also manually add the following Registry keys:
Set registry as follows:

ROOT:Local Machine
Key: SOFTWARE\Microsoft\Jet\4.0\Engines
Name:SandBoxMode
Value:#00000002

ROOT:Local Machine
Key: Software\Microsoft\Office\11.0\Access\Security
Name:Level
Value:#00000001

If these are just for your use, you can create a self cert on your computer
and digitally sign your databases. More info at:
http://www.microsoft.com/resources/documentation/office/2003/all/reskit/en-us/seca02.mspx

Other link to see:
http://office.microsoft.com/assista...ID=CH010411421033&CTT=4&Origin=CH010411391033

Frequently asked questions about Access security warnings:
http://office.microsoft.com/assista...ID=HA011225981033&CTT=4&Origin=CH010411391033

More info here:
How to configure Jet 4.0 to prevent unsafe functions from running in Access 2003
http://support.microsoft.com/default.aspx?kbid=294698

Still more info here:
http://www.fmsinc.com/free/tips.html#accesstip19

Another link on the subject:
http://www.access.qbuilt.com/html/vba.html#SetMacroSecLvl

An online course
http://office.microsoft.com/training/training.aspx?AssetID=RC011461801033

And a very interesting work-around presented by TC:IMO the best way is to start the database via a script file which sets
the macro security level to low for that single invocation of Access.
This does not require a certificate, or a registry change, and it does
not affect any other database(s) - just the one being started by that
script.

Eg. in VBScript:

dim o
set o=createobject ("Access.Application")
o.automationsecurity=1 ' set macro security LOW.
o.opencurrentdatabase "full path to your database"
o.usercontrol=true
set o=nothing
 
Arvin, thanks for the reply, but this is a bit over my head. It's obviously
a subroutine program, but where does it go? Why isn't there the ability to
do this more simply in Access without having to write subprograms? This
wasn't a problem in Access 2k
 
I don't think that there are any "zoom macros" so you'll need to use code
here. A lot of simple "programming" can be done with macros, but not
everything. Besides, a little VBA coding experience can only help enhance
your application.

The code I wrote below is an example of how to open a report from a button
(cmdPreview) on a form. You could add the second line of code in the Open
event of the report itself. To do that open the report in design view, open
the Property Sheet (F4 or View ... Properties) Then click on the Event tab
of the Property Sheet. Click in the On Open box, then click the down arrow
and choose [Event Procedure]. Click on the Ellipsis (...) button. It will
create the code stub. All you need to do is add the 1 line of code copied
and pasted from this post:

Private Sub Report_Open(Cancel As Integer)
DoCmd.RunCommand acCmdZoom100
End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
That was easy to do, however, the command wasn't accepted. I got a runtime
error #2046 saying that "zoom 100" is not available right now. Is this
because is was done in Access 2k format?

Arvin Meyer said:
I don't think that there are any "zoom macros" so you'll need to use code
here. A lot of simple "programming" can be done with macros, but not
everything. Besides, a little VBA coding experience can only help enhance
your application.

The code I wrote below is an example of how to open a report from a button
(cmdPreview) on a form. You could add the second line of code in the Open
event of the report itself. To do that open the report in design view,
open
the Property Sheet (F4 or View ... Properties) Then click on the Event tab
of the Property Sheet. Click in the On Open box, then click the down arrow
and choose [Event Procedure]. Click on the Ellipsis (...) button. It will
create the code stub. All you need to do is add the 1 line of code copied
and pasted from this post:

Private Sub Report_Open(Cancel As Integer)
DoCmd.RunCommand acCmdZoom100
End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

Nathan said:
Arvin, thanks for the reply, but this is a bit over my head. It's obviously
a subroutine program, but where does it go? Why isn't there the ability
to
do this more simply in Access without having to write subprograms? This
wasn't a problem in Access 2k
 
in message:
That was easy to do, however, the command wasn't accepted. I got a runtime
error #2046 saying that "zoom 100" is not available right now. Is this
because is was done in Access 2k format?

The acCmdZoom100 needs to be in the code routine that opens the
report from the form (not the report's open event) per Arvin's first instructions:

Private Sub cmdPreview_Click()
DoCmd.OpenReport "YourReportNameHere", acViewPreview
DoCmd.RunCommand acCmdZoom100
End Sub
 
I don't have any idea at this point where or how to do this. Why can't the
newer versions of Access, have incorporated in the programming to open the
report to the same size window that it was last in when closed as it was in
Access 2k and earlier?
 
in message:
I don't have any idea at this point where or how to do this. Why can't the
newer versions of Access, have incorporated in the programming to open the
report to the same size window that it was last in when closed as it was in
Access 2k and earlier?

How are you opening the report Nathan?
Are you just opening it from the Database Window?

You need to have a form that opens the report via a command button
and then just use the simple code Arvin has supplied.

Like so:

Private Sub cmdPreview_Click()
DoCmd.OpenReport "YourReportNameHere", acViewPreview
DoCmd.RunCommand acCmdZoom100
End Sub

Now before you ask, the general consensus is that end users should
not be interacting with the Database Window directly. This is too
dangerous because you never know what end users can do to screw
up your application! You'd be surprised how tempted a user will be
and go "I wonder what *this* does?"
:-)

End users should only be interacting with forms. They will use forms
for data entry and opening/printing reports.

Do you need help setting up a form to launch this report?
 
YES Thankyou!!!!!:-) :-)
Jeff Conrad said:
in message:


How are you opening the report Nathan?
Are you just opening it from the Database Window?

You need to have a form that opens the report via a command button
and then just use the simple code Arvin has supplied.

Like so:

Private Sub cmdPreview_Click()
DoCmd.OpenReport "YourReportNameHere", acViewPreview
DoCmd.RunCommand acCmdZoom100
End Sub

Now before you ask, the general consensus is that end users should
not be interacting with the Database Window directly. This is too
dangerous because you never know what end users can do to screw
up your application! You'd be surprised how tempted a user will be
and go "I wonder what *this* does?"
:-)

End users should only be interacting with forms. They will use forms
for data entry and opening/printing reports.

Do you need help setting up a form to launch this report?
 
in message:
YES Thankyou!!!!!:-) :-)

Was that "Yes" to my question about setting up the form?

If so, we can create something very generic and then you
can customize it to your hearts content.

1. Create a new blank form (not using the wizard) and do
not give it a Recordsource.

2. With the control wizards enabled drop a new command
button on the form. The wizard will then take you through
a quick series of steps.

3. On the first screen select the option in the left list box called
"Report Operations." On the right side choose "Preview Report."
Hit Next.

4. On the next screen, select the report you want to open from
the list provided. Hit Next.

5. On the next screen you can either choose to display a text
message on the command button or a picture. I'll let you decide
which one you would like. Hit Next when ready.

6. On the last screen we need to name this command. Name it
cmdPreviewReport and then hit the Finish button.

7. The wizard will close and you can now see your command
button. Right click on that button and select Properties from
the list provided.

8. On the Event or All tabs look for an option called "On Click."
You will notice it says [Event Procedure]. This means there is
some code attached to that particular control event. Hit the button
just to the right of this line that has the three dots on it [...]
You will now be taken to the code window for this form and
specifically the Click event for this command button.

9. The wizard will have created "similar" to the following:

Private Sub cmdPreviewReport_Click()
On Error GoTo Err_cmdPreviewReport_Click

Dim stDocName As String

stDocName = "YourReportNameHere"
DoCmd.OpenReport stDocName, acPreview

Exit_cmdPreviewReport_Click:
Exit Sub

Err_cmdPreviewReport_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewReport_Click

End Sub

10. What we need to do is add one more line of code to this procedure
just below the DoCmd line like so:

Private Sub cmdPreviewReport_Click()
On Error GoTo Err_cmdPreviewReport_Click

Dim stDocName As String

stDocName = "YourReportNameHere"
DoCmd.OpenReport stDocName, acPreview
DoCmd.RunCommand acCmdZoom100

Exit_cmdPreviewReport_Click:
Exit Sub

Err_cmdPreviewReport_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewReport_Click

End Sub

11. Now save and close the form and give it a meaningful name.

12. Open the form in normal view and press the button. Presto,
the report opens up and set at 100%!!

13. Now if you want to have the report be maximized AND 100%
then just go back to the form code and add in one more line like so:

Private Sub cmdPreviewReport_Click()
On Error GoTo Err_cmdPreviewReport_Click

Dim stDocName As String

stDocName = "YourReportNameHere"
DoCmd.OpenReport stDocName, acPreview
DoCmd.Maximize
DoCmd.RunCommand acCmdZoom100

Exit_cmdPreviewReport_Click:
Exit Sub

Err_cmdPreviewReport_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewReport_Click

End Sub

14. That's it!!

Hope that helps,
 
I apologize. I assumed that it would work on the On Open event of the
report, but in actuality it needs to be done before then. The original code
I offered has been in successful use for some time. You will need to open
the report from a command button on a form with that code.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access Downloads
http://www.datastrat.com
http://www.mvps.org/access

Nathan said:
That was easy to do, however, the command wasn't accepted. I got a runtime
error #2046 saying that "zoom 100" is not available right now. Is this
because is was done in Access 2k format?

Arvin Meyer said:
I don't think that there are any "zoom macros" so you'll need to use code
here. A lot of simple "programming" can be done with macros, but not
everything. Besides, a little VBA coding experience can only help enhance
your application.

The code I wrote below is an example of how to open a report from a button
(cmdPreview) on a form. You could add the second line of code in the Open
event of the report itself. To do that open the report in design view,
open
the Property Sheet (F4 or View ... Properties) Then click on the Event tab
of the Property Sheet. Click in the On Open box, then click the down arrow
and choose [Event Procedure]. Click on the Ellipsis (...) button. It will
create the code stub. All you need to do is add the 1 line of code copied
and pasted from this post:

Private Sub Report_Open(Cancel As Integer)
DoCmd.RunCommand acCmdZoom100
End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

Nathan said:
Arvin, thanks for the reply, but this is a bit over my head. It's obviously
a subroutine program, but where does it go? Why isn't there the ability
to
do this more simply in Access without having to write subprograms? This
wasn't a problem in Access 2k
In line:

Okay, so I start Access 2k3, open the appropriate folder, and then DB.
When
I open any report, it comes up in a small window that is ~ 25% - 33%
of a
full window and the report maginification is in "fit" mode. When opening
reports, how do I get them to come up in a maximized window at 100%
magnification without having to max. the window and change the
magnification
each time I open one?

Something like this ourght to do it:

Private Sub cmdPreview_Click()
DoCmd.OpenReport "YourReportNameHere", acViewPreview
DoCmd.RunCommand acCmdZoom100
End Sub

While I'm at it, I have set up several DB's in Access 2k, on a
diferent
computer. How do I get rid of the security warning that suggests a "macro
virus"? Can I do this without having purchase additional software?

Tools ... Macro ... Security ... Low (Not Recommended)

The Not Recommended is by Microsoft.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access Downloads
http://www.datastrat.com
http://www.mvps.org/access
 
Thankyou very much for your time Jeff. I understood your directions very
well. However, I am still getting the same error code - Runtime error #2046
...........Zoom100% not available now. If I don't get back to you right away,
it is because I have much happening in the next couple of days. I'm
wondering if this is a bug in the Access program? I sould note that when the
report comes up in the small window, I can bring it up to full window @100%
zoom, but in to additional moves.
Jeff Conrad said:
in message:
YES Thankyou!!!!!:-) :-)

Was that "Yes" to my question about setting up the form?

If so, we can create something very generic and then you
can customize it to your hearts content.

1. Create a new blank form (not using the wizard) and do
not give it a Recordsource.

2. With the control wizards enabled drop a new command
button on the form. The wizard will then take you through
a quick series of steps.

3. On the first screen select the option in the left list box called
"Report Operations." On the right side choose "Preview Report."
Hit Next.

4. On the next screen, select the report you want to open from
the list provided. Hit Next.

5. On the next screen you can either choose to display a text
message on the command button or a picture. I'll let you decide
which one you would like. Hit Next when ready.

6. On the last screen we need to name this command. Name it
cmdPreviewReport and then hit the Finish button.

7. The wizard will close and you can now see your command
button. Right click on that button and select Properties from
the list provided.

8. On the Event or All tabs look for an option called "On Click."
You will notice it says [Event Procedure]. This means there is
some code attached to that particular control event. Hit the button
just to the right of this line that has the three dots on it [...]
You will now be taken to the code window for this form and
specifically the Click event for this command button.

9. The wizard will have created "similar" to the following:

Private Sub cmdPreviewReport_Click()
On Error GoTo Err_cmdPreviewReport_Click

Dim stDocName As String

stDocName = "YourReportNameHere"
DoCmd.OpenReport stDocName, acPreview

Exit_cmdPreviewReport_Click:
Exit Sub

Err_cmdPreviewReport_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewReport_Click

End Sub

10. What we need to do is add one more line of code to this procedure
just below the DoCmd line like so:

Private Sub cmdPreviewReport_Click()
On Error GoTo Err_cmdPreviewReport_Click

Dim stDocName As String

stDocName = "YourReportNameHere"
DoCmd.OpenReport stDocName, acPreview
DoCmd.RunCommand acCmdZoom100

Exit_cmdPreviewReport_Click:
Exit Sub

Err_cmdPreviewReport_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewReport_Click

End Sub

11. Now save and close the form and give it a meaningful name.

12. Open the form in normal view and press the button. Presto,
the report opens up and set at 100%!!

13. Now if you want to have the report be maximized AND 100%
then just go back to the form code and add in one more line like so:

Private Sub cmdPreviewReport_Click()
On Error GoTo Err_cmdPreviewReport_Click

Dim stDocName As String

stDocName = "YourReportNameHere"
DoCmd.OpenReport stDocName, acPreview
DoCmd.Maximize
DoCmd.RunCommand acCmdZoom100

Exit_cmdPreviewReport_Click:
Exit Sub

Err_cmdPreviewReport_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewReport_Click

End Sub

14. That's it!!

Hope that helps,
 
in message:
Thank you very much for your time Jeff. I understood your directions very
well. However, I am still getting the same error code - Runtime error #2046
..........Zoom100% not available now. If I don't get back to you right away,
it is because I have much happening in the next couple of days. I'm
wondering if this is a bug in the Access program? I should note that when the
report comes up in the small window, I can bring it up to full window @100%
zoom, but in to additional moves.

Hi Nathan,

Glad you have the form set up now. From here you can customize the look
and feel of your report just the way you would like. You can even launch
some of your other reports from this form as well.

Ok, back to the issue at hand. First guess I have to the Runtime error is
that you still have this command in the **report's** Open event:

DoCmd.RunCommand acCmdZoom100

If so, remove it and then everything will we Ok.

If you still have problems, then please post all the code you have in
the Event Procedure for the command button, as well as any code
you may have in the report itself.

Hope that helps,
 
Thanks so much. It works!!!! Why didn't I think of going back to the event
tab in design view report? Everything's fine now, your help is much
appreciated.
 
in message:

Hi Nathan,
Thanks so much. It works!!!!

Excellent, glad to hear you have it working now.
Why didn't I think of going back to the event
tab in design view report?

A better question would be, why did I forget to remind you
to remove the report code?
;-)
Everything's fine now, your help is much appreciated.

Sweet. Glad we could help.

If you would like to study up on the topic of Interface Design,
you might check out this information here:

http://www.ltcomputerdesigns.com/JCReferences.html#InterfaceDesign

Good luck with your project.
 
Back
Top