Solved

data format problem from access through vb6

Posted on 2009-04-06
4
175 Views
Last Modified: 2013-12-25
hi
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.
raza
0
Comment
Question by:helloraza
[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
  • 2
  • 2
4 Comments
 
LVL 47

Expert Comment

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

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

Wayne
0
 

Author Comment

by:helloraza
ID: 24075949
thanks

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.
regards.
raza
0
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 125 total points
ID: 24075962
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.
0
 

Author Closing Comment

by:helloraza
ID: 31566942
ok
got it.
many thanks for prompt reply.
ragards.
raza

0

Featured Post

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.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…

697 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