Combining IF statements

  • Thread starter Thread starter pow67
  • Start date Start date
P

pow67

I have the following fields in my Access database:

[PrintBold] =Y/N field
[DNDAddress] = Y/N field (Do not display address)
[Name] = Text field
[Address] = Text field

Selected records are printed in bold based on the following code:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If [PrintBold] = True then
Me![Name].FontWeight = 700
Me![Address].FontWeight = 700

Else
Me![Name].FontWeight = 400
Me![Address].FontWeight = 400

End If

End Sub

There are some records, bold and non bold, where I would like to print
[Name] but not show [Address]. How do I incorporate a second if
condition into my code:

If [DNDAddress] = True then
Me![Address].Visible = True
Else
Me![Address].Visible = False

End If

I thought I found the answer using "Elseif" but I could not get it to
work.

Thanks in advance.

CW
 
Thanks for the fast response but my code works by itself I just do not
know how to incorporate it with the other IF statement for [BoldPrint].

I would like to print bold with address and bold without.

CW
 
Thanks for the help. Problem solved. I did not realize each If..then
statement needed a separate End If statement.

I had only one End If statement at the end of the Sub. When I added
another End If the code worked fine.

CW
 
Back
Top