Solved

10 01 11 00__Numbers are Driving Me Crazy

Posted on 2000-05-11
6
153 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
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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

792 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