Closing a preview report

M

Mikey B

I am restricting access to my DB by disabling all menus using this code in my
main switchboard:

Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = False
Next i
I use a passworded backdoor to enable these.

My problem is that i need a way to close a preview of a report.
My report only has Windows Min/Exit buttons so I created a custom menu that
has close and zoom on it.
However I cannot get the menouto show when loading the report preview
I am using this in Open envent on the report:

DoCmd.ShowToolbar "Report Bar", acToolbarYes

I am self taught so I apologize if this is something obvious. But it is
eluding me.
Thanks for any help.
 
M

Marshall Barton

Mikey B said:
I am restricting access to my DB by disabling all menus using this code in my
main switchboard:

Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = False
Next i
I use a passworded backdoor to enable these.

My problem is that i need a way to close a preview of a report.
My report only has Windows Min/Exit buttons so I created a custom menu that
has close and zoom on it.
However I cannot get the menouto show when loading the report preview
I am using this in Open envent on the report:

DoCmd.ShowToolbar "Report Bar", acToolbarYes


You are using two different ways of dealing with command
bars. The ShowToolbar method corresponds with the Visible
property, which will have no effect on a disabled
commandbar. Either use the Visible property in the
switchboard or use the Enabled property in the report's open
event.

If you avoided disabling the Report Bar in the switchboard
form, then you would not have to worry about it appearing
until a report that uses it is previewed.
 
M

Mikey B

Ahh, yeah. That makes sense.
Thanks much.

Marshall Barton said:
You are using two different ways of dealing with command
bars. The ShowToolbar method corresponds with the Visible
property, which will have no effect on a disabled
commandbar. Either use the Visible property in the
switchboard or use the Enabled property in the report's open
event.

If you avoided disabling the Report Bar in the switchboard
form, then you would not have to worry about it appearing
until a report that uses it is previewed.
 

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