By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,657 Members | 1,029 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,657 IT Pros & Developers. It's quick & easy.

If Statement in an Access Report

P: n/a
I have an Access Report that I am trying to enter an "If Statement"
that when a certain field exceeds a certain number of lines or a
certain number of characters that field is not visible and another
field on a second page becomes visible. Following is my "If Statement"
that doesn't work. My issue is how to refer to the number of lines or
the field size in the "If Statement".

If Me!CertDescription.FieldSize > 100 Then
Me.Label140.Visible = True
Me.Line143.Visible = True
Me.Text141.Visible = True
Me.Label145.Visible = True
Me.CertDescription.Visible = False
Else
Me.Label140.Visible = False
Me.Line143.Visible = False
Me.Text141.Visible = False
Me.Label145.Visible = False
Me.CertDescription.Visible = True
End If

Thank you

Jan 19 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
You need to get the length of the value in the field (assuming this is a
text field). FieldSize would be the value you set for the field in the table
design or the size of a memo field in a recordset object.

If Len(Me!CertDescription) > 100 Then

You may also be able to use the following if the field is a memo field.

If Me.Recordset.CertDesription.FieldSize > 100 Then

Testing this, it will work in a form, but the Recordset object isn't
available for access this way in a report. However, the Len() function and
FieldSize properties will not necessarily return the same value. The
FieldSize property will tell you how bytes the memo field is has, not how
many characters are in the field. This will probably be twice the number of
characters, even with Unicode Compression set to Yes in the table design. In
Access 97, they may be the same.

--
Wayne Morgan
MS Access MVP
<dk*******@yahoo.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
I have an Access Report that I am trying to enter an "If Statement"
that when a certain field exceeds a certain number of lines or a
certain number of characters that field is not visible and another
field on a second page becomes visible. Following is my "If Statement"
that doesn't work. My issue is how to refer to the number of lines or
the field size in the "If Statement".

If Me!CertDescription.FieldSize > 100 Then
Me.Label140.Visible = True
Me.Line143.Visible = True
Me.Text141.Visible = True
Me.Label145.Visible = True
Me.CertDescription.Visible = False
Else
Me.Label140.Visible = False
Me.Line143.Visible = False
Me.Text141.Visible = False
Me.Label145.Visible = False
Me.CertDescription.Visible = True
End If

Thank you

Jan 19 '06 #2

P: n/a
Thanks Wayne, but it didn't work. It is a memo field and I entered
your suggested:

If Me.Recordset.CertDescription.FieldSize > 100 Then

but I received a message stating that "This feature is not available in
and MDB"

Thanks Dedee

Jan 19 '06 #3

P: n/a
Wayne, even though the field is a memo field, the "recordset" did not
work but your other suggestion did. Any problems that I coul have in
the future by using your first suggestion?

Thanks.

Jan 19 '06 #4

P: n/a
As stated, the recordset isn't available in a report, just a form. Did you
try using the Len() function instead?

--
Wayne Morgan
MS Access MVP
<dk*******@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Wayne, even though the field is a memo field, the "recordset" did not
work but your other suggestion did. Any problems that I coul have in
the future by using your first suggestion?

Thanks.

Jan 19 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.