OK RayDru . . . Here we go . . .
[ol][li]Right-Click the Menubar. Click [blue]Customize[/blue] - [blue]Commands Tab[/blue].[/li]
[li]In [blue]Categories[/blue] click [purple]File[/purple].[/li]
[li]In [blue]Commands[/blue], find the [purple]print icon[/purple] and [blue]drag/drop[/blue] to the right side of the last menu on the MenuBar.[/li]
[li]Right-Click the button you just installed.[/li]
[li]In the [blue]Name:[/blue] at the top enter [purple]Rpt1[/purple].[/li]
[li]Further down make sure [purple]Image and Text[/purple] is checked.[/li]
[li]Further down click [purple]Properties[/purple].[/li]
[li]Change the [purple]Caption:[/purple] to the text you want to see in the button. [blue]Print Report[/blue] for example.[/li]
[li]Remove any [purple]Shortcut Text:[/purple][/li]
[li]Add a [purple]ScreenTip Text:[/purple] if you like. This is what appears if you hover the mouse over the button.[/li]
[li]In the [purple]On Action:[/purple] enter [purple]
=PrtRpt1()[/purple]. This is the name of the routine that will run when you click the button.[/li]
[li]Close the [blue]File Control Properties[/blue].[/li]
Now you could leave the button ([blue]
PHVs suggestion[/blue]). If you want it in a menu continue with the steps.
[li]Your gonna drag/drop the button to the [blue]print section[/blue] of the [blue]File Menu[/blue]. Before you do, read the following.
When you drag/drop, first drag and hover over the File Menu on the Menu Bar. It will expand. Move down to the print section (a black line will show you where you are) and drop at the top of the print section. If you miss, you can drag/drop up & down to get it right.
Note: if for any reason the menu closes up on you, just left-click the file menu to drop it again.
Perform the drag/drop.[/li]
[li]Right-Click the [blue]button below yours[/blue] and put a check in [purple]Begin a Group[/purple].[/li]
[li]Close the [blue]Customize[/blue] window.[/li]
[li]If you click on the button now. you should get an error about not finding [blue]PrtRpt1[/blue].[/li][/ol]
In a module in the modules window, copy/paste the following code:
Code:
[blue]Public Function PrtRpt1()
Dim Msg As String, Style As Integer, Title As String
Dim DL As String, Criteria As String
DL = vbNewLine & vbNewLine
Criteria = "[Name]='frmRfi' AND [Type] = -32768"
If Not IsNull(DLookup("[Type]", "MSysObjects", Criteria)) Then
If IsOpenForm("frmRfi") Then
DoCmd.OpenReport "rptRfi", acViewNormal
Else
Msg = "Can't Print Report!" & DL & _
"Form 'frmRfi' is not open!" & DL & _
"Open the form and try again . . ."
Style = vbCritical + vbOKOnly
Title = "Form Not Open Error! . . ."
MsgBox Msg, Style, Title
End If
Else
Msg = "Form 'frmRfi' Not In This Database!"
Style = vbCritical + vbOKOnly
Title = "Form Object Missing Error! . . ."
MsgBox Msg, Style, Title
End If
End Function
Function IsOpenForm(frmName As String) As Boolean
Dim cp As CurrentProject, Frms As Object, Criteria As String
Set cp = CurrentProject()
Set Frms = cp.AllForms
If Frms.Item(frmName).IsLoaded Then
If Forms(frmName).CurrentView > 0 Then IsOpenForm = True
End If
Set Frms = Nothing
Set cp = Nothing
End Function[/blue]
[purple]Thats it . . . give it a whirl & let us know . . .[/purple]
See Ya! . . . . . .