View Single Post
  #4  
Old December 13th, 2009, 12:46 PM posted to microsoft.public.access.gettingstarted
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default If-Then-Else statements

Or shorter:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
'Suppress the printing of the Payment Information when the PaymentID
control value is null'

Me.PaymentID.Visible = Not IsNull([PaymentID])
Me.PaymentAmt.Visible = Not IsNull([PaymentID])
Me.PaymentDate.Visible = Not IsNull([PaymentID])

End Sub


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"Daniel Pineault" wrote in
message ...
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

.