Very Simple code Not Working To Make Pic Visible / Invisible (1 Viewer)

Ashfaque

Student
Local time
Today, 04:35
Joined
Sep 6, 2004
Messages
894
Hi,

I have a small report where I placed a small JPG pic which I want to make it visible or invisible based on data available in one of the text box.

I have tried placing following very simple code OnOpen, OnActivate, OnLoad and OnCurrent event of this report at may times but still not taking effect.

If IsEmpty(Me.HrSignPwd) Then
Me.HrSign.Visible = False
Else
Me.HrSign.Visible = True
End If

By Default visibility of HrSign pic is kept OFF.

I know this might be very simple but in my 2016 Access it is not working at all.

Kindly support.

Ashfaque
 

Minty

AWF VIP
Local time
Today, 00:05
Joined
Jul 26, 2013
Messages
10,371
You say report - you probably need to put it in the OnFormat event?
 

Ashfaque

Student
Local time
Today, 04:35
Joined
Sep 6, 2004
Messages
894
Yes, it is my report but both picture and text box are placed in details section of the report. And the code I placed in OnCurrent event of the report.
I tried even changing the new by defualt keyword (IsVisible) in the modified code but still no appearance of the pic

But when I changed code to below, it is working fine.

If Len(Me.HrSignPwd > 0) Then

Me.HrSign.Visible = True

ElseIf IsNull(Me.HrSignPwd) Then

Me.HrSign.Visible = False
End If

But when form is completely empty,...I mean not data on form and user click to see preview, the pic is appearing which I dont want to. I m trying further..
 

Minty

AWF VIP
Local time
Today, 00:05
Joined
Jul 26, 2013
Messages
10,371
Reports don't work like forms. OnFormat will affect the results you want correctly I think, but probably not in Report View.
OnCurrent won't work in a report the way you want.

Try it in Print Preview mode, and also set it to not be visible by default, and only visible if HrSignPwd is Not Null?
 

Users who are viewing this thread

Top Bottom