Luigi-
Sure!
Dim ctl As Control
' Loop through all controls on the form
For Each ctl In Me.Controls
' First, make it visible
ctl.Visible = True
' Check the ControlType
Select Case ctl.ControlType
' Check any control that contain a value
Case acCheckBox, acComboBox, acListBox, acOptionButton, acTextBox, acToggleButton
If IsNull(ctl.Value) Then ctl.Visible = False
End Select
Next ctl
You don't need to check labels (unless you're interested in the Caption property) as long as labels are all attached correctly to the related editable control. When you set the control Visible = False, the attached label should disappear, too.
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
(Paris, France)
On Oct 5, 2014, at 10:34 AM, bondurri.luigi <no_reply@yahoogroups.com> wrote:
Hi all, I'm trying to show in a form, fields (and labels) only if they are not null.
field by field I can do in this way:
____________________________
Private Sub Form_Current()
'If IsNull(FIELD1) Or FIELD1= "" Then
' FIELD1.Visible = False
Else
FIELD1.Visible = True
end If
end sub
____________________________
there is the possibility in your opinion to let MSaccess check on current event ALL fields in the form and apply the visible property if each field is not null?
Thanks for your support
Luigi
__._,_.___
Posted by: John Viescas <johnv@msn.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar