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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

command button in report

Status
Not open for further replies.

Frederic74

Technical User
Jul 15, 2004
20
GB
I want to put a command button in the page footer of my report. However once I have placed it, it doesn't allow me to add a macro. Actually the only thing I can change within the properties is the format, but not the event. Anybody know why that could be and what I can do to solve it?
Any help would be much appreciated, kind regards

Frederic
 
You cannot put buttons on reports.
You will have to create your own toolbar and display that when the report opens (and hide it when the report closes).
 
You can't have a command button on a report. In the design view behaves like a form and View as print prview.
Tell us what you are going to achieve with a command button

________________________________________________________________________
Zameer Abdulla
Visit Me
By the time a man realizes that may be his father was right,
he usually has a son who says,
"Father, you are wrong!".
 
In normal view my reports data is too small to be properly analysed. However if I maximise it, it is too big and I can't see the controls to move to the next page of the report etc.
I am sure there must be some code, which says something like maximise to 90%, unfortunately I am fairly new to visual basics and find myself unable to do it myself, hence I thought a command button to move to the next record in the footer would do the trick, but as you just said I can't.
 
If you are new to Access then you'd have not changed the toolbar/menubar of the report.
You have Zoom in the menubar and go to page at the footer side.
You can try
[tt]
Private Sub Report_Open(Cancel As Integer)
DoCmd.Maximize
End Sub
[/tt]
[tt]
DoCmd.RunCommand acCmdZoom100
[/tt]
This sometime produces error.

________________________________________________________________________
Zameer Abdulla
Visit Me
By the time a man realizes that may be his father was right,
he usually has a son who says,
"Father, you are wrong!".
 
Thanks for that. Much appreciated. However as you said it did give me a compile error. Is there not a chance just to have a simple code to zoom it to 90%?

I tried the following as well:

Private Sub Report_Open(Cancel As Integer)
DoCmd.RunCommand acCmdZoom90
End Sub

Doesn't work easier.

 
Thanks again. As I mentioned I am pretty new to access and especially visual basics. But I can't place it in the open event, as when I do I get a compile error again. So I have tried it as general code the following way:

Function PreviewAndZoomReport(ShowSearchResultsRpt As String, ZoomCoeff As Integer)

On Error GoTo Error_Handler

If Not (ZoomCoeff >= 0 And ZoomCoeff <= 2500) Then
ZoomCoeff = 90
End If

With DoCmd
.OpenReport ShowSearchResultsRpt, View:=acViewPreview
.Maximize
End With
Reports(ShowSearchResultsRpt).ZoomControl = ZoomCoeff

Exit Function
Error_Handler:
MsgBox Err.Description
Resume Next

But it doesn't work again. I am sorry I feel a bit useless. But thanks for trying to make me understand.
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top