Sub report VBA not firing when loaded through main report (1 Viewer)

Juett

Registered User.
Local time
Today, 13:39
Joined
Jul 16, 2019
Messages
71
Hi Guys,

I have a little issue with some VBA code in a sub report.

The following code works in the sub report when opened directly:

Code:
Private Sub Report_Load()
If IsNull(cmb1.Value) Then
    Me.img1.Visible = False
Else
    Me.img1.Visible = True
End If
End Sub

It displays or hides an image based on the value of a combo box.

But...when I insert this report as a sub report in another (main form) and open it, the code does not fire.

What do you think I might be missing?

Thanks very much.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 20:39
Joined
May 7, 2009
Messages
19,233
reports event don't fire when inserted as subreport.
set it on the main reports load event:

private sub report_load()
me.subreportname!img1.Visible = (IsNull(me.subreportname!cmb1)=False)
end sub
 

Juett

Registered User.
Local time
Today, 13:39
Joined
Jul 16, 2019
Messages
71
That worked perfectly, thanks very much!
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 20:39
Joined
May 7, 2009
Messages
19,233
you are welcome!
 

Users who are viewing this thread

Top Bottom