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

Custom Menu in Preview Report

Status
Not open for further replies.

robcarr

Programmer
May 15, 2002
633
GB
Dear All,

I have this menu below created when the preview report button is pressed on the form, when they select print it prints the menu and not the report, how do I get it to activate the report before doing the send keys command.

Function ShowPopup()
Dim coord As POINTAPI
Dim attr&

GetCursorPos coord
DoCmd.OpenForm "Pop-up Menu Form"

attr& = GetWindowLong(Forms![Pop-up Menu Form].hwnd, GWL_STYLE)
attr& = SetWindowLong(Forms![Pop-up Menu Form].hwnd, GWL_STYLE, _
attr& And Not WS_DLGFRAME)

DoCmd.MoveSize (coord.x * 14), (coord.y * 14), , 1100
End Function

Function ItemSelected(WhichItem As String)
DoCmd.Close
Dim stDocName As String
Dim rptCurrentReport As Report
Set rptCurrentReport = Screen.ActiveReport
stDocName = rptCurrentReport.Name
If Trim(WhichItem) = "Close Report" Then
DoCmd.Close acReport, stDocName, acSaveNo
Else
SendKeys "^p", False
DoCmd.OpenForm "Pop-up Menu Form"

End If
End Function

Thanks Rob.[yoda]
 
Try
Reports!ReportName.setfocus
before the print command
 
I cant seem to get this to work, ReportName should be the name of the report, but I use this coding for various reports, the report names are stored in Stdocname but I cant get your line to work with stdocname.

rob.

Thanks Rob.[yoda]
 
In that case it should be:
Stdocname.setfocus
 
I tried this and it didnt work either,

I have used the printout option and this works fine, only draw back is it doent allow you to choose the printer you want to print to, it always prints to the default.


Thanks Rob.[yoda]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top