HandleButtonClick / Hourglass issue

M

MaBell

Hi guys,

I have a form with a few labels using an On Click =HandleButtonClick()
event. This event sets attributes depending on the select case of the
=HandleButtonClick() then all cases go to a DoCmd.OpenForm command. I want
to put an hourglass true/false before after the OpenForm command but it
doesn't seem to work with the =HandleButtonClick() function. Any
suggestions? Or what else can i do to tell the user that the App is running
from the time they click the label till the report opens?


Private Function HandleButtonClick(intBtn As Integer)
Dim stDocName As String

On Error GoTo HandleButtonClick_Err

Const conNewMoney = 1
Const conAUM = 2
Const conNewPlanAssets = 3
Const conNewMoneyYTD = 4
Const conAUMYTD = 5
Const conClose = 6


Select Case intBtn
Case conNewMoney
stDocName = "rptNewMoney"
Case conAUM
stDocName = "rptAssetsUnderManagement"
Case conNewPlanAssets
stDocName = "rptNewPlanAssets"
Case conNewMoneyYTD
stDocName = "rptNewMoneyYTD"
Case conAUMYTD
stDocName = "rptAUMYTD"
Case conClose
DoCmd.Close
GoTo HandleButtonClick_Exit
Case Else
MsgBox "Invalid button clicked!"
GoTo HandleButtonClick_Exit
End Select

If IsNull(cboSalesYear) Then
MsgBox "Please select Report Year"
GoTo HandleButtonClick_Exit
End If

Select Case intBtn
Case conNewMoney, conNewPlanAssets, conAUM
If IsNull(cboSalesMonth) Then
MsgBox "Please select Report Month"
GoTo HandleButtonClick_Exit
End If
End Select

DoCmd.Hourglass True

On Error Resume Next
DoCmd.OpenReport stDocName, acPreview
If Err = 2501 Then Err.Clear

DoCmd.Hourglass False

HandleButtonClick_Exit:
Exit Function

HandleButtonClick_Err:
MsgBox Err.Description
Resume HandleButtonClick_Exit


End Function
 
A

Alex Dybenko

Hi,
it does not switch to hourglass or what is wrong? your code looks ok.

you can also try to use Application.echo, see help for more info
 

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