473,386 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 2398
set the field to double in Access

--
-dlbjr

Discerning resolutions for the alms
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Batista, Facundo | last post by:
Here I send it. Suggestions and all kinds of recomendations are more than welcomed. If it all goes ok, it'll be a PEP when I finish writing/modifying the code. Thank you. .. Facundo
20
by: Patrick Guio | last post by:
Dear all, I have some problem with insertion operator together with namespace. I have a header file foo.h containing declaration of classes, typedefs and insertion operators for the typedefs in...
3
by: (Pete Cresswell) | last post by:
I've got this DoCmd in a fields Change() event so that as the user types, the underlying table (also visible in another screen...) will be updated in realtime - instead of waiting for the screen TB...
4
by: italia | last post by:
I changed the Fieldsize Property from text to Long Integer and Decimal Places = 6. I had decimals in the original field. But after the transfer, the digits after the decimals are gone. Now...
1
by: Guadala Harry | last post by:
What do to about conversion to decimal type when blank is allowed? The situation is this. In the UI there is a textbox into which users can enter a value which is supposed to be a dollar amount....
10
by: Paul Sullivan | last post by:
decimal d; d = 1.1M OR d= (decimal) 1.1 Discussioon
18
by: Kuljit | last post by:
I am doing Engineering(B.Tech) in Computer Science. I have a question for which i am struggling to write a C code(program). It struck me when we were being taught about a program which counts the...
1
by: rjames.clarke | last post by:
I am inserting a record in to a mysql database. I'd like to know the record number of that record. I use a index field which is auto-incremented. Is there any way to get a field value returned...
6
by: barcaroller | last post by:
If I insert/remove an element in a set, will an iterator to this set automatically become invalid? Does the position of the iterator before the insertion/removal matter? How are vectors and...
1
by: tariquetuku | last post by:
When i want to put a value of 10000 in a decimal(6,2) variable, mysql shows me the out of range error error!! Can anyone solve it?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.