Solved

10 01 11 00__Numbers are Driving Me Crazy

Posted on 2000-05-11
6
155 Views
Last Modified: 2010-05-02
Hi,
I only have 20 points, if you can help me 15 of them are yours.

I declared c_Loan as currency in my VB program, the corresponding field in the access db is currency data type. Yet when I save, it does not save the decimals. 222.65 saves as 222. What am I doing wrong.

Do I have to format text boxes to show the decimals?

Any help would be appreciated. Have a good day programming. Thank you.

diek
0
Comment
Question by:diek_nf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 2

Accepted Solution

by:
BobbyOwens earned 15 total points
ID: 2799873
Makre sure your field in the database is set to 2dp, or to Auto. (Check this by opening the table in design mode, selecting the field and checking the "Decimal Places" setting)

Also ensure that when the value is shown in the text box, it is done with comething like:

Format(value,"#.00#")

Lastly, check the value doesn't get read into a long or integer accidentally in VB Code
0
 
LVL 12

Expert Comment

by:mark2150
ID: 2799876
Let's see you save/Load code please.

Normally what you're doing sounds like it should work.

Yes, the text boxes don't automatically know how many decimals to show.

The text box's .Text property is a string. If you're doing something like:

RS.Edit
RS!CurrencyField = Text1.Text
RS.Update

This can be the cause of the problem.

M
0
 
LVL 5

Expert Comment

by:Voodooman
ID: 2800060
Hi

I have had problems with Currency Type before and I dont use them

I use Single instead.

From an accuracy point of view currency is theoretically more accurate.

You would have to be using very large amounts of money for it make any difference.

Try using a single instead.

I work with fianacials and cash flow for companies with $1 billion and No one ever complained about any very small rounding errors.

Good Luck

Voodooman!
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 18

Expert Comment

by:deighton
ID: 2800110
>>>Do I have to format text boxes to show the decimals?

Yes.  Or if you enter a value with no decimals e.g. 1234 you have to decide yourself in code if this will be become $1234.00 or $12.34

Is this what is going on?

if text1 was 1234

then

dim x as Currency

x = x = CCur(Text1) / 100

0
 
LVL 18

Expert Comment

by:deighton
ID: 2800111
oops!!

x = CCur(Text1) / 100
0
 

Author Comment

by:diek_nf
ID: 2800174
Bobby,
After playing the field in the db was farged up. The format thing, I took your advice and
'====== FORMAT CURRENCY
        Dim cur_temp_format As Currency

        cur_temp_format = rs_BBILF!Balance
        txtBalance.Text = Format(cur_temp_format, "$##0.00")
        cur_temp_format = 0
'===============================================================================
 If there is a less clutsy way someone please let me know.

Voodoo,
I am going to play with the single.

Thank you, I can always count on everyone to help.

If I can figure out why my ttolbar refuses to stay customized I will truly be a happy camper. If I don't figure it out soon I'll have to post it.

Have a great day programming.

diek
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question