[AccessD] How to display positive or negative number in report
Gustav Brock
gustav at cactus.dk
Sat Jun 6 06:19:51 CDT 2015
Hi Kostas
You could just include it:
="some text <b>" & SgnStr([score]) & CStr([score]) & "</b> some other text"
/gustav
________________________________________
Fra: AccessD <accessd-bounces at databaseadvisors.com> på vegne af Kostas Konstantinidis <kost36 at otenet.gr>
Sendt: 6. juni 2015 13:13
Til: Access Developers discussion and problem solving
Emne: Re: [AccessD] How to display positive or negative number in report
HI Gustav,
How to call the function on Details OnFormat?
thank's for your quickly response
/kostas
-----Αρχικό μήνυμα-----
From: Gustav Brock
Sent: Saturday, June 06, 2015 1:56 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] How to display positive or negative number in report
Hi Kostas
I once made a function for this:
<code>
Public Function SgnStr(ByVal dblVal As Double) As String
' Returns plus or minus sign or space as string according to sign of
dblVal.
' One-line alternative:
' SgnStr = Chr(((Asc(dblVal) = 48) * 12) + 44 - Sgn(dblVal))
' Ascii Value for character between Plus (43) and Minus (45).
Const clngAscSign As Long = 44
Dim strSign As String * 1
If dblVal = 0 Then
' Return empty string.
Else
' Return sign.
strSign = Chr(clngAscSign - Sgn(dblVal))
End If
SgnStr = strSign
End Function
</code>
________________________________________
Fra: AccessD <accessd-bounces at databaseadvisors.com> på vegne af Kostas
Konstantinidis <kost36 at otenet.gr>
Sendt: 6. juni 2015 12:42
Til: Access Developers discussion and problem solving
Emne: [AccessD] How to display positive or negative number in report
Hi all,
I use +#.###;-#.###;#.### as format to display positive or negative numbers
in form
But how to syntax it to display in report specially if the number is part of
an unbound like?
= "some text<b>" & [score] & "</b> some other text"
[score] is the number field
thank’s a lot
/kostas
More information about the AccessD
mailing list