Clear form value after report loads

J

Jake F

I have a report w/ sub report based on the same query. I use a combo box and
filter based on the value selected in the combo box. Here is my coding for
it. The problem is that the value is cleared before the subreport can load.
Is there a way to tell it to load the subreport and then clear the box or do
I need to put the clear somewhere else? Thanks.

Private Sub Combo13_AfterUpdate()
DoCmd.Hourglass (hourglassOn)
DoCmd.OpenReport "rptScoreStats", acViewPreview
Me!Combo13.Value = Null
DoCmd.Hourglass (Hourglassoff)
End Sub
 
A

Arvin Meyer [MVP]

Add a delay in your code to give the report time to load:

http://www.datastrat.com/Code/Delay.txt

so your code would now look like:

Private Sub Combo13_AfterUpdate()
DoCmd.Hourglass (hourglassOn)
DoCmd.OpenReport "rptScoreStats", acViewPreview

Delay (3) ' 3 second delay

Me!Combo13.Value = Null
DoCmd.Hourglass (Hourglassoff)
End Sub
 

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