View Single Post
  #3  
Old December 12th, 2009, 10:45 PM posted to microsoft.public.access.gettingstarted
Daniel Pineault
external usenet poster
 
Posts: 658
Default If-Then-Else statements

How about:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
'Suppress the printing of the Payment Information when the PaymentID
control value is null'
If IsNull([PaymentID]) = True Then
Me.PaymentID.Visible = False
Me.PaymentAmt.Visible = False
Me.PaymentDate.Visible = False
Else
Me.PaymentID.Visible = True
Me.PaymentAmt.Visible = True
Me.PaymentDate.Visible = True
End If
End Sub

--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.



"BarbS via AccessMonster.com" wrote:

I'm presently studying Access and having difficulty understanding building
event codes. What I'm trying to do is suppress the printing of three
controls in a report if they are Null. This is how I wrote the code, but it
is not working. Can someone please help. Thank you,

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
'Suppress the printing of the Payment Information when the PaymentID
control value is null'
If IsNull([PaymentID]) Then
[PaymentID] , [PaymentAmt], [PaymentDate].Visible = False

Else: [PaymentID].Visible = True

End If
End Sub

--
Message posted via http://www.accessmonster.com

.