Question : NZ Dlookup  and If statement

This is going to be a little hard to explain.
I have this code:
Private Sub Report_Open(Cancel As Integer)

    Dim ctl As Control
 
 If Nz(DLookup("Address3", "tblSupplier", "DealID = " & Forms!frmDeals!DealID)) = "" Then
 For Each ctl In Me.Controls
   If ctl.Tag = "Not Visible" Then
    ctl.Visible = False
   Else
    ctl.Visible = True
   
 End If
 Next ctl
 End If
End Sub

Now it is testing for Address3 being "".
My next test would be for Address4 Not "" and Address3 ""
The next test would be for Address5 Not "" and Address4 ""

Not sure how to incorporate.  I am not a programmer.

Thank you.

Answer : NZ Dlookup  and If statement




Petrobras
try this

Dim i As Integer, ctl As Control
For i = 3 To 6
    If IsNull(Reports("rptApplication")("rptAppSectionMultipleSuppliers").Report("Address" & i)) Then
        For Each ctl In Reports("rptApplication")("rptAppSectionMultipleSuppliers").Report.Controls
              If ctl.Tag = i Then
              ctl.Visible = False
   
              End If
        Next ctl

    End If
Next

---------
thanks Alan
;-)
Random Solutions  
 
programming4us programming4us