Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dataformat not supported for DataSource

Status
Not open for further replies.

DMG2000

Programmer
Aug 13, 2000
52
US
I have a textbox that calls info from a db query, the value is supposed to be currency and it appears that way in the db container, however, when running the VB app, the values are being shown as integer...is there a solution to correct this, or perhaps I need to set a format in the db (it wont allow me to do a data format within VB)? Please help!
 
I have written a VB app that queries a SQL database and populates a text box with the answer in currency: $345.00

This is the code I used:

Textbox.Text = Format(rs.Fields("DrySalesCost"), "\$###,###,##0.00")

Format is the function you want to use.

Format(data to format,the format to use)

The Format function can be found in your VB help.

When I queried my database I set each column to a variable, so I could easily access the individual column data. For instance:

request = "select SUM((qty_sold * selling_price)) As DrySalesCost from selnet where gro_class =1"
' Open the Recordset.
Set rs = m_DBConnection.Execute( _
request, , adCmdText)
Textbox.Text = Format(rs.Fields("DrySalesCost"), "\$###,###,##0.00")
rs.Close

If you need further explanation e-mail me at mcrisson@mitchellgrocery.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top