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

Gustav Brock gustav at cactus.dk
Sat Jun 6 05:56:37 CDT 2015


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