stopping a hyphen

  • Thread starter Thread starter Angi
  • Start date Start date
A

Angi

I'm using the following to populate my text box. If the acctbal is a
negative number, it wraps it. How can I stop this from happening and
keep the - with the number?

Code:
Forms!deprec2!txtInfo = "This invoice is paid, but there are " &
InvCount & " outstanding invoices on this account with a balance of " &
Format(AcctBal, "$#,##0.00;$-#,##0.00") & ". The payment is more than
is owed on the account. You will need to issue a credit if you accept
this payment."

TIA!
 
Angi,
Expirement with a wider or narrower text control. That should cause the
"wrap" to occur before or after the number.

hth
Al Camp
 
Write your own little function like (aircode):

Public Function MyFormat(varIn As Variant) As String
On Error Resume Next ' use better error handling

If IsNumeric(varIn) Then
MyFormat = Format(varIn, "$#,##0.00")
Else
MyFormat = ""
End If

End Function

Substitute your function:

Forms!deprec2!txtInfo = "This invoice is paid, but there are " &
InvCount & " outstanding invoices on this account with a balance of " &
MyFormat(AcctBal) & ". The payment is more than
is owed on the account. You will need to issue a credit if you accept
this payment."
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Thanks for the replies! I don't want to change the size of the text
box, so I tried the function idea. That, unfortunately, didn't work
either. It's still putting the - on the previous line and then the
$1600.00. Any other ideas?? I thought about putting a hard return in,
but with smaller amts, I think it will look stupid. Isn't there a
bracket or some other syntax thays "keeps this together as a group"?
 
Thanks for the replies! I don't want to change the size of the text
box, so I tried the function idea. That, unfortunately, didn't work
either. It's still putting the - on the previous line and then the
$1600.00. Any other ideas?? I thought about putting a hard return in,
but with smaller amts, I think it will look stupid. Isn't there a
bracket or some other syntax thays "keeps this together as a group"?

Might it help to put a blank before the - sign?

John W. Vinson[MVP]
 
Thanks for the reply, John. I just added a return. It looks alright,
so that'll have to do for now. Thanks for all the suggestions!!! It
helps to have more than head...especially when mine is fried!

Have a good one!
 
Angi,
Try rephrasing your concatenation slightly to force that wrap to occur in
a different place...
You wrote
" outstanding invoices on this account with a balance of "
Try
" outstanding invoices against this account with a balance of "
That might force the whole -number onto the next line.
hth
Al Camp
 
Hi Angi,

Just a thought: what happens if you use the Unicode minus sign (U+2212)
in the format string instead of the hyphen?

...Format(AcctBal, "$#,##0.00;$" & ChrW(&H2212) & "#,##0.00")
 
Back
Top