?
Solved

Displaying on a report

Posted on 2016-10-27
2
Medium Priority
?
24 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

765 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