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

Hidden form prints instead of report

Status
Not open for further replies.

crisis2007

Technical User
Apr 2, 2007
114
US
I have an application I created in MS Access 97 that uses a hidden form to detect idle time. It closes the application when enough time transpires without activity. I have a menu in my application with several command buttons. Each button calls up a separate report in print preview. When I go to print (no matter what report I choose), it prints the hidden form, not the report. I can not find a fix for this without creating a custom print menu (which I prefer not to do). Does anyone have any suggestions?
 
how are you making it print? VBA macro toolbar?

Ian Mayor (UK)
Program Error
9 times out of 10 I know what I'm talking about. This must be my tenth reply.
 
I print it from the built-in toolbar menu off the print preview screen (file > print)
 
How are ya crisis2007 . . .

As a test ... [blue]stop the timer in the hidden form[/blue] then see if reports print ...

If the above doesn't work try resetting the button:
[ol][li]Right-click the menubar and select [blue]Customize[/blue].[/li]
[li]On the [blue]Toolbars[/blue] tab put a check in the box for [blue]Print Preview[/blue]. The toolbar should appear!.[/li]
[li][blue]Remove the print button[/blue] then click the [blue]Reset[/blue] button in the customize dialog window ... [blue]which should put the button back[/blue].[/li]
[li]Close out the customize dialog and perform your testing.[/li][/ol]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Thank you for responding! I tried the first test you suggested. I stopped the timer on the form and the report did print.
 
crisis2007 . . .

What value are you setting the [blue]Timer Interval[/blue] to? Also ... how about posting the code in the [blue]Timer[/blue] event!

Curious this ... what version access are you using?

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
The timer interval is set to 1000. I am using Access 97. Here is the code in the timer event:


Private Sub Form_Timer()
' IDLEMINUTES determines how much idle time to wait for before
' running the IdleTimeDetected subroutine.
Const IDLEMINUTES = 8

Static PrevControlName As String
Static PrevFormName As String
Static ExpiredTime

Dim ActiveFormName As String
Dim ActiveControlName As String
Dim ExpiredMinutes

On Error Resume Next

' Get the active form and control name.

ActiveFormName = Screen.ActiveForm.Name
If Err Then
ActiveFormName = "No Active Form"
Err = 0
End If

ActiveControlName = Screen.ActiveControl.Name
If Err Then
ActiveControlName = "No Active Control"
Err = 0
End If

' Record the current active names and reset ExpiredTime if:
' 1. They have not been recorded yet (code is running
' for the first time).
' 2. The previous names are different than the current ones
' (the user has done something different during the timer
' interval).
If (PrevControlName = "") Or (PrevFormName = "") _
Or (ActiveFormName <> PrevFormName) _
Or (ActiveControlName <> PrevControlName) Then
PrevControlName = ActiveControlName
PrevFormName = ActiveFormName
ExpiredTime = 0
Else
' ...otherwise the user was idle during the time interval, so
' increment the total expired time.
ExpiredTime = ExpiredTime + Me.TimerInterval
End If

' Does the total expired time exceed the IDLEMINUTES?
ExpiredMinutes = (ExpiredTime / 1000) / 60
If ExpiredMinutes >= IDLEMINUTES Then
' ...if so, then reset the expired time to zero...
ExpiredTime = 0
' ...and call the IdleTimeDetected subroutine.
IdleTimeDetected ExpiredMinutes
End If
End Sub


Sub IdleTimeDetected(ExpiredMinutes)
'Dim Msg As String
'Msg = "No user activity detected in the last "
'Msg = Msg & ExpiredMinutes & " minute(s)!"
'MsgBox Msg, 48

DoCmd.OpenForm "frm_ExitNonUse"

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top