[AccessD] How to display positive or negative number in report

Kostas Konstantinidis kost36 at otenet.gr
Sat Jun 6 06:41:03 CDT 2015


Gustav,
just noticed that if the number is negative e.g. -2 it returns double minor

some text --2 some text

thank's
/kostas


-----Αρχικό μήνυμα----- 
From: Kostas Konstantinidis
Sent: Saturday, June 06, 2015 2:29 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] How to display positive or negative number in report

yes... Gustav,

many thank's
/kostas


-----Αρχικό μήνυμα----- 
From: Gustav Brock
Sent: Saturday, June 06, 2015 2:19 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] How to display positive or negative number in report

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

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com 



More information about the AccessD mailing list