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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DECIMAL AND ZERO AFTER BEING DROPPED FROM RECORDSET?? 1

Status
Not open for further replies.

faxpay

Programmer
Nov 30, 2004
119
US
I am using an Access 2000 database and VB6. Using a data class module and a SQL string I am creating a recordset. For all my numbers in the database the .00 after the number is being dropped. The .00 appears on the datasheet in Access but the recordset does not return it. In Access if I change the datatype from number to string the .00 still does not appear in my recordset. It would appear as though it is not getting stored in the database as it appears on the datasheet.

I need that .00 as I am building ASSCII files without decimals and need the 00 after removing the decimal.

Any help is appreciated.

faxpay, Tom
 
Trailing zeros after the decimal place or leading zeros before it are formatting issues. They are never stored in the database for numeric data types.

You can get them to appear by defining your output fields this way

Select Format (FieldName, "0.00") As [FmtField], ...
 
Golom,
Surely they(.00) should be stored when type is a string and they are not. Got to be another answer.
Tom
 
Are you using an export spec? Sometimes formatting information that you don't want is saved in the spec.

Run your query with the formatting you want (try adding CStr() around Format() if you still don't get what you want), export manually, and save a new spec. See if that spec works for the next export.

John
 
JonFer,

Excuse my ignorence but I do not know what a spec or export spec is??? Export manually???

In any case I'm convinced now that databse does not store leading or trailing zeros. I will do work around.

faxpay, Tom
 
Golom,

I'm convinced now that the database does not store leading or trailing zeros. I will work around that. Thank You for setting me straight.

faxpay, Tom
 
You said you were creating ASCII files and I assumed you were using the TransferText method and providing an export specification. You create an export specification by doing an export manually (Save As/Export menu item) and saving your settings before completing the export by using the Advanced button.



John
 
John,
I see the misunderstanding now. I am creating the ASCII file in VB6 not Access. I put this in the Access forum because I thought someone here could help as to how the database was storing the numbers.

Thank you for your input.

faxpay,Tom
 
Doesn't have VB6 a Format function ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top