470,647 Members | 1,187 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,647 developers. It's quick & easy.

DECIMAL PROBLEM AFTER INSERTION

I have hancoded the asp page for inserting the values into an Ms Access
Database and it work fine

The problem I am facing is that once I insert any value with Decimals like " 11.95" or 222.02 or 227.021 it is either rounding it up or taking only the
numbers before the decimals.

I want to keep these values as it is exactly entered through the form, so
that while I retrieve the data inserted I want the values to have decimals.
I am sure that this problem is with Ms access, As I am not so good with
access I need to know what all options should I choose under the General TAb during the Design view of the Access Database.

As with my asp code here it is :-

<%

Dim a,s,b,d,t

carrier_type=Request.Form("cmb_carrier")

ticket_no=Request.Form("txtTicketNo")

pax_name=Request.Form("txtPaxName")

pax_type=Request.Form("cmb_pax_type")

airport_tax=Request.Form("txtAirportTax")

get_cash=Request.Form("txtCash")

get_invoice=Request.Form("txtInvoice")

get_date=Request.Form("txtDate")

get_sector=Request.Form("txtSector")

a=Request.Form("txtActualFare")

s=Request.Form("txtSellingFare")

b=Request.Form("txtBspFare")

d=Request.Form("txtDiscount")

t=Request.Form("txtGeneralTax")

if len(get_cash)=0 then
get_cash=0
end if

if len(get_invoice)=0 then
get_invoice=0
end if

if len(airport_tax)=0 then
airport_tax=0
end if

Dim AF,SF,BF,sum

AF = cdbl(a) + cdbl(t)

SF = cdbl(s) + cdbl(t)

BF = cdbl(b) + cdbl(t)

sum = cdbl(SF) - cdbl(BF)

set cn=server.CreateObject("adodb.connection")
Set rs=Server.CreateObject("adodb.recordset")
mp=server.MapPath("salesDB.mdb")
cn.Open"provider=Microsoft.jet.oledb.4.0;Data Source="&mp
SQLstmt="Insert into
Sales(Carrier,ticket_n,NameOfPassenger,TypeOfPasse nger,AirportTax,Cash,Invoi ce,myDate,Sector,ActualFare,SellingFare,BSPFare,Di scount,GeneralTax,Profit)" SQLstmt = SQLstmt & "VALUES ('" & carrier_type & "','" & ticket_no & "','" & pax_name & "','" &pax_type & "','" & airport_tax & "','" & get_cash & "','"& get_invoice & "','" & get_date & "','"& get_sector & "','" & cdbl(AF) &
"','" & cdbl(SF) & "','" & cdbl(BF) & "','" & cdbl(d) & "','" & cdbl(t) &
"','" & cdbl(sum) & "')"

'Response.Write SQLstmt

Response.Write "<br><br><br><br><br><br><br><br><br><br><br><br>< h1 align = 'center'><font color='0095CC'> THANK YOU </font></h1><br><br><br><br>"
cn.Execute SQLstmt

please help

Jul 19 '05 #1
1 2312
set the field to double in Access

--
-dlbjr

Discerning resolutions for the alms
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

21 posts views Thread by Batista, Facundo | last post: by
20 posts views Thread by Patrick Guio | last post: by
10 posts views Thread by Paul Sullivan | last post: by
18 posts views Thread by Kuljit | last post: by
1 post views Thread by rjames.clarke | last post: by
6 posts views Thread by barcaroller | last post: by
1 post views Thread by Korara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.