Discussion Locked

Access-Hide empty controls on a report

0 helpful
10 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a user that is creating a report. Their are two address fields, Address1 and Address2. Address2 field is used if their is a suite, etc. Many times this field is blank.

How can we show the field in the report when their is data in the field and hide the field (remove the blank space created by the field) when the field is empty?

Thank you

10 replies

by sankulpune

Hello Sakil,

In the 'Format' event-procedure of the 'Detail' section of the form 'Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)', paste the following code:

If (Len(Me.Address2.Properties("Text")) < 1) Then

Me.Address2.Properties("Visible") = False

Else

Me.Address2.Properties("Visible") = True

End If

Your feedback will be highly appreciated.

with regards,

SanganakSakha,
Simple And Effective Solutions To Small Problems, No QuickFixes.

by sankulpune

Hello Sakil,

In the 'Format' event-procedure of the 'Detail' section of the form 'Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)', paste the following code:

If (Len(Me.Address2.Properties("Text")) < 1) Then

Me.Address2.Properties("Visible") = False

Else

Me.Address2.Properties("Visible") = True

End If

Your feedback will be highly appreciated.

with regards,

SanganakSakha,
Simple And Effective Solutions To Small Problems, No QuickFixes.

by sankulpune

Hello Sakil,

In the 'Format' event-procedure of the 'Detail' section of the form 'Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)', paste the following code:

If (Len(Me.Address2.Properties("Text")) < 1) Then

Me.Address2.Properties("Visible") = False

Else

Me.Address2.Properties("Visible") = True

End If

Your feedback will be highly appreciated.

with regards,

SanganakSakha,
Simple And Effective Solutions To Small Problems, No QuickFixes.

by bowjangles

You must set the can grow property of the field to YES. Make the field really really small so you cant even see it on the report. When data is in that field it will grow to the appropriate size and if no data the field is so small you won't see itanyways. You can also do it reversely, Set the can shrink property to YES and leave the field normal size and when there is no data it will shrink.

Let me know if this helped.

Thanks

Justin

This discussion is closed to new replies.