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

Access- Decimal part missing

Status
Not open for further replies.

elizcelt

Programmer
Jun 21, 2001
4
MX
Hi everyone!
I hope you could help me!
In my access database, I have numeric fields with decimals, and when I try to pass a value from ASP to any of these fields the decimal part is rounded, why?
Here is the example code:
<%
wCuota = Trim(Request.Form(&quot;Cuota&quot;))
Set oConn = Server.CreateObject (&quot;ADODB.Connection&quot;)
oConn.Open &quot;Provider=Microsoft.Jet.OLEDB.4.0; Data Source=&quot;& Server.MapPath(&quot;../datos/datos.mdb&quot;)

Set RS = Server.CreateObject (&quot;ADODB.RecordSet&quot;)
sql = &quot;SELECT * from afiliado where afiliado = 178&quot;

RS.Open sql, oConn , 2, 3

RS(&quot;cuota_vista&quot;) = wCuota
RS.Update

Response.Write &quot;Value of my Variable:&quot; & wCuota
Response.Write &quot;Value of my Field: &quot; & RS(&quot;cuota_vista&quot;)
%>

The result is something like this:

Value of my Variable:15.75
Value of my Field: 16

The data type in the access field is numeric.

I don't know why, and I've searching about it, but I can't find an answer yet.

Thanks in advance.
Elizabeth
 
The field in access may be number but the datatype (format etc) may be set to soemthing causing the rounding. double check the settings.

if it is
fieldsize: long integer, integer, single, double
decimals: auto, 0,1,2,3,4, etc...

____________________________________________________
The most important part of your thread is the subject line.
Make it clear and about the topic so we can find it later for reference. Please!! faq333-3811

onpnt2.gif
 
should be
Field Size: double
Decimal Places: 2


____________________________________________________
The most important part of your thread is the subject line.
Make it clear and about the topic so we can find it later for reference. Please!! faq333-3811

onpnt2.gif
 
Thank you so much, as matter of fact, I didn't realize, it was setting as Integer, I'm such a newbie on this, but I'm learning, thank you.
 
Numeric datatypes on Access tend to default to integer. You will need to change it to something like double and set the decimal places.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top