Make Visible When Field Is Not Empty (1 Viewer)

eirman

Registered User.
Local time
Today, 11:08
Joined
Aug 16, 2013
Messages
38
I've got a memo field on a form where the name is TextEXTRA
The Control Source for TextEXTRA is EXTRA.
I've got a box called BoxSHOW (Visible = No)

As I browse through records or find records, I want the box to become visible when there is something in the EXTRA field and become invisible when the EXTRA field is empty. This is what I've tried .....

Private Sub Form_Current()
If EXTRA Is Not Null Then
BoxSHOW.Visible = True
End If
End Sub

I tried many variations on the first line such as ...
Me.EXTRA "EXTRA" TextEXTRA
but I always get errors.
 

RuralGuy

AWF VIP
Local time
Today, 04:08
Joined
Jul 2, 2005
Messages
13,826
Try:
Code:
Private Sub Form_Current()
   If Len(Me.txtEXTRA & "") > 0 Then
      Me.BoxSHOW.Visible = True
   Else
      Me.BoxSHOW.Visible = False
   End If
End Sub
 

eirman

Registered User.
Local time
Today, 11:08
Joined
Aug 16, 2013
Messages
38
That works brilliantly RuralGuy. I'd never have worked that out myself (especially the "") ... Many thanks.

Incidently, the box goes around a button which opens a popup form to view extra information, when it exists.
No box .... no extra info ... so no point in clicking.

By the way, was my use of is not null with the IF syntaxically incorrect or just plain wrong?
 

spikepl

Eledittingent Beliped
Local time
Today, 12:08
Joined
Nov 3, 2010
Messages
6,144
syntactically :D

And it was wrong in VBA - that test belongs to SQL. In VBA there is a function IsNull
 

eirman

Registered User.
Local time
Today, 11:08
Joined
Aug 16, 2013
Messages
38
syntactically :D

And it was wrong in VBA - that test belongs to SQL. In VBA there is a function IsNull

IsNull is noted for future reference .... Thanks again
 

RuralGuy

AWF VIP
Local time
Today, 04:08
Joined
Jul 2, 2005
Messages
13,826
You're welcome and it looks like you got the correct answer to your other question.
 

Users who are viewing this thread

Top Bottom