I want to display a label on my main form only when certain fields on my
subform are not null. I know my code is incorrect, but I need help making it
right. Thanks in advance.
Sub ShowIssueComplete()
If Me.frmQuestions.Response1.IsNull = True
Me.frmQuestions.Response2.IsNull = True
Me.frmQuestions.Response3.IsNull = True
Me.frmQuestions.Response4.IsNull = True
Me.frmQuestions.Response5.IsNull = True
Me.frmQuestions.Response6.IsNull = True
Then
Me.lbDecisionComplete.Visible = True
Else
Me.lbDecisionComplete.Visible = False
End If
End Sub
Barry Gilbert - 31 Mar 2006 18:44 GMT
Try this:
Sub ShowIssueComplete()
If IsNull(Me.frmQuestions.Form.Response1) And _
IsNull(Me.frmQuestions.Form.Response2) And _
IsNull(Me.frmQuestions.Form.Response3) And _
IsNull(Me.frmQuestions.Form.Response4)l And _
IsNull(Me.frmQuestions.Form.Response5) And _
IsNull(Me.frmQuestions.Form.Response6) Then
Me.lbDecisionComplete.Visible = True
Else
Me.lbDecisionComplete.Visible = False
End If
End Sub
It assumes you want the Visibility based on all fields being null. If
not, replace the ANDs with ORs.
Barry
Klatuu - 31 Mar 2006 20:11 GMT
Here is a little technique that will minimize the amount of coding you will
need.
Dim intCtr As Integer
Dim blnMakeVisible as Boolean
blnMakeVisible = True
With Me.frmQuestions
For intCtr = 1 to 6
If Not IsNull(.Controls("Response" & Cstr(intCtr))) Then
blnMakeVisible = False
Exit For
End If
End With
Me.lbDecisionComplete.Visible = blnMakeVisible
> I want to display a label on my main form only when certain fields on my
> subform are not null. I know my code is incorrect, but I need help making it
[quoted text clipped - 18 lines]
>
> End Sub