Solved

Displaying on a report

Posted on 2016-10-27
2
21 Views
Last Modified: 2016-10-27
I have this code in the onprint event of the detail section of a report which works fine if there is data:

    If Me.txtType2 = "COMPLETE" Then
        Me.chkbxConformed.Visible = True
        Me.txtRetDate.Visible = False
    End If

    If Not IsNull(Me.txtRetDate) Then
        If Me.txtType2 = "PLATING" Or Me.txtType2 = "CALIBRATION" Or Me.txtType2 = "CHECK FIT" Then
            Me.chkbxConformed.Visible = False
            Me.txtRetDate.Visible = True
        End If
    End If

Open in new window


But if the report has no data I get an error that reads, "You entered an expression that has no value.  The debug highlights the first line of the code.  How do I avoid this?
0
Comment
Question by:SteveL13
2 Comments
 

Author Comment

by:SteveL13
ID: 41863035
Sorry...  correction in code:

    If Me.txtType2 = "COMPLETE" Then
        Me.chkbxConformed.Visible = True
        Me.txtRetDate.Visible = False
    End If

    If Me.txtType2 = "PLATING" Or Me.txtType2 = "CALIBRATION" Or Me.txtType2 = "CHECK FIT" Then
        Me.chkbxConformed.Visible = False
        Me.txtRetDate.Visible = True
    End If

Open in new window

0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 41863048
try adding a  line to check if the report has data

if Reports("NameOfReport").HasData then

    If Me.txtType2 = "COMPLETE" Then
        Me.chkbxConformed.Visible = True
        Me.txtRetDate.Visible = False
    End If

    If Me.txtType2 = "PLATING" Or Me.txtType2 = "CALIBRATION" Or Me.txtType2 = "CHECK FIT" Then
        Me.chkbxConformed.Visible = False
        Me.txtRetDate.Visible = True
    End If
End if

or prior to opening the report, check if there will be data, cancel opening of the report is there is no data
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question