473,587 Members | 2,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

If Statement in an Access Report

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!CertDescript ion.FieldSize > 100 Then
Me.Label140.Vis ible = True
Me.Line143.Visi ble = True
Me.Text141.Visi ble = True
Me.Label145.Vis ible = True
Me.CertDescript ion.Visible = False
Else
Me.Label140.Vis ible = False
Me.Line143.Visi ble = False
Me.Text141.Visi ble = False
Me.Label145.Vis ible = False
Me.CertDescript ion.Visible = True
End If

Thank you

Jan 19 '06 #1
4 9184
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!CertDesc ription) > 100 Then

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

If Me.Recordset.Ce rtDesription.Fi eldSize > 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*******@yaho o.com> wrote in message
news:11******** *************@g 43g2000cwa.goog legroups.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!CertDescript ion.FieldSize > 100 Then
Me.Label140.Vis ible = True
Me.Line143.Visi ble = True
Me.Text141.Visi ble = True
Me.Label145.Vis ible = True
Me.CertDescript ion.Visible = False
Else
Me.Label140.Vis ible = False
Me.Line143.Visi ble = False
Me.Text141.Visi ble = False
Me.Label145.Vis ible = False
Me.CertDescript ion.Visible = True
End If

Thank you

Jan 19 '06 #2
Thanks Wayne, but it didn't work. It is a memo field and I entered
your suggested:

If Me.Recordset.Ce rtDescription.F ieldSize > 100 Then

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

Thanks Dedee

Jan 19 '06 #3
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
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*******@yaho o.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1944
by: The Eeediot | last post by:
Hello, SQL gurus! This message use HTML tables (in case you see a bunch of gobbledy-gook). I need to modify an SQL statement: SELECT DISTINCT Trim(InvtID)+', '+Trim(Descr) AS Item, month, Sum(QtyShip) AS Qty FROM Sales_View GROUP BY Trim(InvtID)+', '+Trim(Descr), month, CustID HAVING (CustID)= @CustID )
7
35667
by: Bob | last post by:
Currently I am using this statement to translate 3 fields in my db thru Visual Basic. I import the data from one table to another then call the IFF statements and the NewDate to translate the fields. Can this be done in an Access db? I am trying to learn how to do these things in Access vs Visual Dim strIIF As String Dim sstrIIF As String...
7
11430
by: mark | last post by:
Access 2000: I creating a report that has a record source built by the user who selects the WHERE values. An example is: SELECT * FROM CHARGELOG WHERE STDATE Between #10/27/2003# And #11/2/2003# And VehicleID='00000000' And BattID='LKO500HF'. I need to use the records returned to populate text boxes, but the data requires further...
5
3257
by: dkelly925 | last post by:
Is there a way to add an If Statement to the following code so if data in a field equals "x" it will launch one report and if it equals "y" it would open another report. Anyone know how to modify this? Private Sub cmdPreview_Click() On Error GoTo Err_Handler 'Purpose: Open the report filtered to the items selected in the list box....
4
18801
by: Anja | last post by:
Hi everyone, I am trying to use the expression builder to create input to a control in an Access report. I have a table called Records and I want to select the minimum date for a record where the student = studentID.. The sql is pretty simple: "Select MIN(RecDate) from records_T where studentID = 1".
1
5029
by: anthonyjm | last post by:
I need to run a report for each record returned from a SQL Select statement. The report changes for each record, so they need to be run separately. So something like this (I have no idea what the syntax would be): strSelect = "SELECT field1, field2, field3 FROM table1 WHERE field4 = '1';" results = DoCmd.RunSQL strInsert foreach results AS...
9
1879
by: ontherun | last post by:
Hi all, I am using MS Access 2002. i am building a database for a Finance Company I have 2 tables - tblCustomer (personal Details and PK is LoanNumber) tblLoan (PK is LoanID) Relationship is 1-to-many. With the information i have gained so far from TSDN forum, i could write some VBA code for my database. I close...
0
1387
by: angi35 | last post by:
In Access 2000, I'm trying to create a couple reports but can't figure out the queries. 1. In a form, I have a control with a dollar amount, with the source field . Then there's an option group to indicate if the amount is 1) estimated or 2) firm, with the source field . On my report, I want to have one control that shows the dollar amount...
13
19376
by: curious80237 | last post by:
In Access 2003: A table with four yes/no fields is part of a query used as data source for a report. The yes/no fields show in the datasheet and the report as checkboxes; the default value of the field is "no". The report pulls in a subreport. I want the subreport to be visible ONLY if any of the yes/no fields contain a yes (showing as a check...
0
7920
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8215
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5718
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5394
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3844
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.