Currency is Not working

G

Guest

I have done my home work and spent hours search the posts and tried every
suggestion. So I am apparently missing sometihing. I have four unbound text
boxes of a form and all I would like is form them to display currency as
$1234.00 etc. in the textboxes format property I tried
$0.00
$###0.00
$0.00; -$0.00; $0.00;$0.00
the last one sort of worked however it places every thing to right of the
decimal point. any help would be sweet thanks
 
G

Guest

Well I tried that one also I have tried to look at all the possiblities and
perhaps I need to be more specific.
As the user is filling out the form and selects the textbox "strLabor" and
enters in the numbers the idea is for the textbox to display the entry in
std. currency format ie $0.00 I have tried most of common formatting schemes.
I don't like asking you guys questions if the info is already been posted but
I am stuck

Thank you for your help in advance you guys are great!!!
 
G

Guest

None of the attempts result in change to textbox the data entered example
2500 is displayed as 2500 if 25.00 is entered it is displayed as 25.00 etc
the thing that has even remotly worked is the last example in my first post.
as you can see this what is frustrating nothing I enter in the format
property of the textbox seems to produce any results. unless my syntax is
wrong thanks again
 
A

Allen Browne

Oh, I think I understand. If the user does not enter a decimal point at all,
you want the value divided by 100? So:
4 = $0.04
25 = $0.25
250 = $2.50
250.12 = $250.12
34.5 = $34.50

If that is the goal, use the AfterUpdate event procedure of the text box to
examine its Text property. If no decimal point is found, divide the value by
100.

Copy the function below into a standard module (created through the Modules
tab of the Database window.) Then if you have a text box called Amount, set
its After Update property to:
=MakeCurrency([Amount])
and so on for your other text boxes.

Public Function MakeCurrency(txt As TextBox)
If IsNumeric(txt.Value) Then
If InStr(txt.Text, ".") = 0 Then
txt.Value = txt.Value / 100
End If
End If
End Function
 
G

Guest

Yes Sir you are right that is exactly what I want to do and I copied the
formulas and placed them in the proper spots and changed the names as
required ie..

=MakeCurrency([strTowCharges]) 'which is the name of one of the text boxs

I made a public function in the module section as listed

Public Function MakeCurrency(txt As TextBox)
If IsNumeric(txt.Value) Then
If InStr(txt.Text, ".") = 0 Then
txt.Value = txt.Value / 100
End If
End If
End Function

The problem is after entering the "=MakeCurrency([strTowCharges]) the
statement turns red and an error pops up
I am sure its something simple I am probably missing I am just to close to
see it can you help?



Allen Browne said:
Oh, I think I understand. If the user does not enter a decimal point at all,
you want the value divided by 100? So:
4 = $0.04
25 = $0.25
250 = $2.50
250.12 = $250.12
34.5 = $34.50

If that is the goal, use the AfterUpdate event procedure of the text box to
examine its Text property. If no decimal point is found, divide the value by
100.

Copy the function below into a standard module (created through the Modules
tab of the Database window.) Then if you have a text box called Amount, set
its After Update property to:
=MakeCurrency([Amount])
and so on for your other text boxes.

Public Function MakeCurrency(txt As TextBox)
If IsNumeric(txt.Value) Then
If InStr(txt.Text, ".") = 0 Then
txt.Value = txt.Value / 100
End If
End If
End Function

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

LtFass said:
None of the attempts result in change to textbox the data entered example
2500 is displayed as 2500 if 25.00 is entered it is displayed as 25.00 etc
the thing that has even remotly worked is the last example in my first
post.
as you can see this what is frustrating nothing I enter in the format
property of the textbox seems to produce any results. unless my syntax is
wrong thanks again
 
A

Allen Browne

You typed:
=MakeCurrency([strTowCharges])
into the Properties box, beside the AfterUpdate property of the text box?

If you set the property to:
[Event Procedure]
then in the code window you would call it like this:
Call MakeCurrency(Me.[strTowCharges])

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

LtFass said:
Yes Sir you are right that is exactly what I want to do and I copied the
formulas and placed them in the proper spots and changed the names as
required ie..

=MakeCurrency([strTowCharges]) 'which is the name of one of the text
boxs

I made a public function in the module section as listed

Public Function MakeCurrency(txt As TextBox)
If IsNumeric(txt.Value) Then
If InStr(txt.Text, ".") = 0 Then
txt.Value = txt.Value / 100
End If
End If
End Function

The problem is after entering the "=MakeCurrency([strTowCharges]) the
statement turns red and an error pops up
I am sure its something simple I am probably missing I am just to close
to
see it can you help?



Allen Browne said:
Oh, I think I understand. If the user does not enter a decimal point at
all,
you want the value divided by 100? So:
4 = $0.04
25 = $0.25
250 = $2.50
250.12 = $250.12
34.5 = $34.50

If that is the goal, use the AfterUpdate event procedure of the text box
to
examine its Text property. If no decimal point is found, divide the value
by
100.

Copy the function below into a standard module (created through the
Modules
tab of the Database window.) Then if you have a text box called Amount,
set
its After Update property to:
=MakeCurrency([Amount])
and so on for your other text boxes.

Public Function MakeCurrency(txt As TextBox)
If IsNumeric(txt.Value) Then
If InStr(txt.Text, ".") = 0 Then
txt.Value = txt.Value / 100
End If
End If
End Function
 
G

Guest

Yep that fixed that problem I forgot all about the "Call" Thank you for your
help as I said before you folks are awsome

Allen Browne said:
You typed:
=MakeCurrency([strTowCharges])
into the Properties box, beside the AfterUpdate property of the text box?

If you set the property to:
[Event Procedure]
then in the code window you would call it like this:
Call MakeCurrency(Me.[strTowCharges])

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

LtFass said:
Yes Sir you are right that is exactly what I want to do and I copied the
formulas and placed them in the proper spots and changed the names as
required ie..

=MakeCurrency([strTowCharges]) 'which is the name of one of the text
boxs

I made a public function in the module section as listed

Public Function MakeCurrency(txt As TextBox)
If IsNumeric(txt.Value) Then
If InStr(txt.Text, ".") = 0 Then
txt.Value = txt.Value / 100
End If
End If
End Function

The problem is after entering the "=MakeCurrency([strTowCharges]) the
statement turns red and an error pops up
I am sure its something simple I am probably missing I am just to close
to
see it can you help?



Allen Browne said:
Oh, I think I understand. If the user does not enter a decimal point at
all,
you want the value divided by 100? So:
4 = $0.04
25 = $0.25
250 = $2.50
250.12 = $250.12
34.5 = $34.50

If that is the goal, use the AfterUpdate event procedure of the text box
to
examine its Text property. If no decimal point is found, divide the value
by
100.

Copy the function below into a standard module (created through the
Modules
tab of the Database window.) Then if you have a text box called Amount,
set
its After Update property to:
=MakeCurrency([Amount])
and so on for your other text boxes.

Public Function MakeCurrency(txt As TextBox)
If IsNumeric(txt.Value) Then
If InStr(txt.Text, ".") = 0 Then
txt.Value = txt.Value / 100
End If
End If
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top