Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access 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 August 11th, 2005, 01:33 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default Display 0 currency as Null String

This is kind of related to LoraLee's Question. I have a report for insurance coverage. There are about 35 values on this report that are stored as numbers in a table, and I display the on the report with the Format Property of the textbox set to currency.

What I need to do is blank out any field where the value is 0
- A blank field means that there may be coverage but it isn't listed, while a 0 amount means there is no coverage -

Anyone know the best way to do this?

Thanks

Mike

Mike
EchoVue.com
__________________
Mike
EchoVue.com
 
Old August 11th, 2005, 01:49 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Mike,
Can't you use the onformat to check the value of each field? If so:
If Value = 0 then
   value = null
end if

I've never tried it, so I don't know if it will work.

Kevin

dartcoach
 
Old August 11th, 2005, 02:08 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Thanks Kevin,

For some reason I couldn't find the OnFormat Event - It seems that reports just don't have the same level of control as forms, but I did put some code into the Report -> Activate event, that checks for a 0 value and then makes the textbox invisible, and that works great.

Thanks again,

Mike

Mike
EchoVue.com
 
Old August 11th, 2005, 02:14 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Mike,

The other way wouldn't have worked anyway, I've been playing with it and it doesn't work.

Kevin

dartcoach
 
Old August 11th, 2005, 02:23 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Kevin,

No worries at all - sometime, you just need someone to bounce ideas off to get you past the mental blocks.

Mike :D

Mike
EchoVue.com
 
Old August 11th, 2005, 02:33 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Mike,
I went back to an old database of mine and found out what I'd done with the same problem.
In the detail section, I created a text box for each field from the table. I.E. mtbl.value1 = table value in currency format.
            myvalue1 = textbox on report
I would then make mtbl.value1 invisible.
in the detail section (or whichever section you're dealing with) I put this in the onformat event:

  If Me.value1 = 0 Then

     Me.myvalue1 = Null
  Else
     Me.myvalue1 = Me.value1
  End If

  Me.myvalue1 = FormatCurrency(Me.myvalue1)



dartcoach





Similar Threads
Thread Thread Starter Forum Replies Last Post
Avoid null display ajaidass ADO.NET 2 January 17th, 2007 03:54 PM
display no heading if null oleafo ASP.NET 1.0 and 1.1 Basics 1 January 8th, 2007 06:23 PM
Display all NULL columns hm_naveen Oracle 2 January 5th, 2007 09:50 AM
Display a Text Field as Currency on a Report CloudNine Access 1 April 8th, 2004 01:24 PM
Display currency amounts, including cents. danielh Javascript How-To 1 January 19th, 2004 06:57 PM





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