Make Visible When Field Is Not Empty

eirman

Registered User.
Local time
Today, 00:47
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.
 
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
 
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?
 
syntactically :D

And it was wrong in VBA - that test belongs to SQL. In VBA there is a function IsNull
 
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
 
You're welcome and it looks like you got the correct answer to your other question.
 

Users who are viewing this thread

Back
Top Bottom