data format problem from access through vb6

Posted on 2009-04-06
Last Modified: 2013-12-25
i am using vb6 with ms acces 2003. i have a field in database with data type "NUMBER" format "CURRENCY" and decimal places "3". in access data is shown with currency symbol and with accurate decimal places.
Problem is , when i try to show the data in a textbox, it just truncate the last zero.
suppose if amount is "23.230" , it shows "23.23".
i have set the data formate property of text box to "CURRENCY".
I CHECKED by putting beak point where recoredset is assigining value to textbox like this

textbox1.text=rs![myamount], it is showing value "23.23" over there as well.
so may be its record set problem or text box.

could please any body guide me for this.

thanks and regards.
Question by:helloraza
  • 2
  • 2
LVL 47

Expert Comment

by:Wayne Taylor (webtubbs)
Comment Utility
To display any number with a trailing zero, you need to convert it to a string....

    textbox1.text=Format(rs![myamount], "$#,##0.000")


Author Comment

Comment Utility

but i was thinking to display as many zeros as the data have, only wondering why it does not show zeros if they are present in database field?

thanks for your reply anyway.
LVL 47

Accepted Solution

Wayne Taylor (webtubbs) earned 125 total points
Comment Utility
The field in the database has it's format set to *display* 3 decimals, but they are not stored that way. They are stored as numbers, without the trailing zeros.

Author Closing Comment

Comment Utility
got it.
many thanks for prompt reply.


Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now