Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 22nd, 2003, 05:51 AM
Registered User
 
Join Date: Aug 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reporting Missing Field Issue

Hello everyone,

I've got a problem, which is probably really issue to solve, but I just can't see the answer.

I have a form with two combo boxes that allows a user to select first a company and then, a product that the selected company supplies. I use the product_id of the selected product as a parameter of the DoCmd.OpenReport method. When the report opens it contains information that is shown in the header and details sections (the report is based on a query and not a recordset).

What I'm trying to do is set the visible property of a label to false if the field it details has no value (makes the report much neater). I'm having no luck trying to code this in within the report itself, as I keep getting a 'can't find this field' error if there is no data within it.

Anyone got any clues? I think I need to code within the form, but not sure how to go about it. I don't really want to go down the setting a global variable route, so I'm resisting like mad! So, any help would be much appreciated.

Thanks,
Karen.

 
Old October 22nd, 2003, 08:23 AM
Authorized User
 
Join Date: Jun 2003
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If I understand you correctly I use something in my reports that may help you. If my report has nothing to print instead of making a label invisible I check the data prior to opening the report, if there is not data a message box is displayed and the process is cancelled. Tried this code placed in your report:

Private Sub Report_NoData(Cancel As Integer)

   MsgBox "No Data", vbOKoNly, "Report Status"
   Cancel = True

End Sub

Hope this helps.

Kenny Alligood
 
Old October 22nd, 2003, 08:55 AM
Registered User
 
Join Date: Aug 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

Thanks for replying.

Not quite. There will always be information that will be printed out within the report (so, the report must always run), just that some information may not be available yet (ie some fields may be empty). So consequently, there may be one or two printed labels (there are loads) with nothing listed beneath them, eg a Description label will always have a description listed below it but an Ingredients label may have nothing.

Karen.,

 
Old October 22nd, 2003, 10:13 AM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is this report based on only one record?
is the Label placed on the Detail section of the report or on the page header. If it is on the page header and there is only one record, do this

    If IsNull(Field1) Then
        Me.Label1.Caption = ""
    End If

I could not get it to work on the detail section. It either made all labels "" or none for each record.


Sal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Missing Parameter Field Current Value vk18 Crystal Reports 2 December 26th, 2007 10:01 AM
Multi-field entry design and reporting Nanette Access 2 October 26th, 2006 11:02 AM
Many field reporting anukagni Access 2 September 27th, 2006 01:37 AM
Reporting Services Install Issue bph Reporting Services 0 August 8th, 2006 01:44 PM
Installing Reporting Services - SSL Issue Terry Spencer BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 7 June 25th, 2004 12:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.