DATABASE Access

Associate
Joined
6 Jun 2004
Posts
93
Location
London
I have a feild in my Access DB which should only hold percentage values. When i submit my form example 90 should be 90% but its writing it as 900.00%. I've tried everything in settting the data types and things like that.

Does anyone have a suggestion as to how I can limit it to one decimal place ie. 33.3% instead of 3300.3000%

thanks for any help in advance!
 
<%
Option explicit
dim PageTitle, Step
PageTitle = "Step " & Step
%>
<!--#include virtual ="/script/breadcrumb.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Internal Recruitment Procedure - Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Form">
<meta name="Keywords" content="">
<meta name="Robots" content="index"><!-- Set to 'index' or 'noindex' as required -->
<meta name="Author" content="">
<script language="JavaScript">
function fieldEnable(field){
field.disabled = false;
field.style.background = "#ffffff";
}

function fieldDisable(field){
field.disabled = true;
field.style.background = "#dddddd";
}
</script>
<script language="JavaScript"><!-- This script does the percentage calculation for costcode-->
function calc1(field) {
If not Costcode1 ="" Then
percent1 = "100%"
end if
}

</script>
<link href="/script/global.css" rel="stylesheet" type="text/css">
<link href="/script/procedures.css" rel="stylesheet" type="text/css">
</head>
<body onload="fnSetDefaults()">
<!--#include virtual="/menu/pageTop.asp"-->
<!-- #include virtual="/menu/lmBlank.inc"--><!-- Local navigation menu -->
</td>
<td class="tdContent" valign="top">
<div style="background:transparent; height:21px;"><img src="/image/spacer.gif" width="540" height="21" border="0" alt=""></div>
<div class="divIntroText">Where am I? <% = BreadCrumb(Request.ServerVariables("PATH_INFO")) %></div>
<div class="divContent">
<!-- Page content -->

<script language="JavaScript1.2" type="text/javascript">
<!--

function SubmitClaim(){
var msgWin = showModalDialog("submitClaim.htm",null,"status:no;center:yes;help:no;minimize:no;maximize:no;border:thin;statusbar:no;dialogWidth:300px;dialogHeight:225px")
}
//-->
</script>
<p>&nbsp;</p>
<form method="post" action="t1formsadd.asp" name="t1forms" onSubmit="SubmitClaim()">
<table class="tblData" cellspacing="2" cellpadding="3" border="0" ID="Table1" width="600">

<tr>
<td class="tdBorder" colspan="4">&nbsp;</td>
</tr>

<tr>
<td width="130" class="tdBorder">Enter your Job Title</td>
<td width="144" class="tdBorder"><input type=text name="JobTitle"></td>
<td width="106" class="tdBorder">&nbsp;</td>
<td width="186" class="tdBorder">&nbsp; </td>
</tr>
<tr>
<td class="tdBorder">Enter Location</td>
<td class="tdBorder"><input type=text name="Location"></td>
<td class="tdBorder">&nbsp;</td>
<td class="tdBorder">&nbsp; </td>
</tr>
<tr>
<td class="tdBorder">Minimum Salary </td>
<td class="tdBorder"><input type=number name="MiSalary"></td>
<td class="tdBorder">Maximum Salary</td>
<td class="tdBorder"><input type=number name="MxSalary"></td>
</tr>
<tr>
<td class="tdBorder">Intranet Job Description</td>
<td class="tdBorder" colspan="3"><textarea name="IJD" cols="50" rows="5"></textarea></td>
</tr>
<tr>
<td class="tdBorder">Cost Code one </td>
<td class="tdBorder"><input type=number name="costcode1" onFocus="calc1(percent1)"></td>
<td class="tdBorder">Allocation one </td>
<td class="tdBorder"><input type= IS_NUMERIC() name="percent1"></td>
</tr>
<tr>
<td class="tdBorder">Cost Code two </td>
<td class="tdBorder"><input type=number name="costcode2" onFocus="calc11(percent2)"></td>
<td class="tdBorder">Allocation two</td>
<td class="tdBorder"><input type=number name="percent2"></td>
</tr>
<tr>
<td class="tdBorder">Cost Code three </td>
<td class="tdBorder"><input type=number name="costcode3"></td>
<td class="tdBorder">Allocation three</td>
<td class="tdBorder"><input type=number name="percent3"></td>
</tr>
<tr>
<td class="tdBorder"></td>
<td class="tdBorder" colspan="2" align="right">Total</td>
<td class="tdBorder"><input type=number name="TotalAll"></td>
</tr>
<tr>
<td class="tdBorder">New Position</td>
<td class="tdBorder" colspan="3"><input type="radio" name="NewP" value="Yes" onClick="fieldDisable(ReplacementBox)">Yes&nbsp;&nbsp;<input type="radio" name="NewP" value="No" onClick="fieldEnable(ReplacementBox)">
No (If &quot;NO&quot;, please complete replacement details below) </td>
</tr>
<tr>
<td class="tdBorder">Replacement</td>
<td class="tdBorder" colspan="3">*Name, Job Tile and Salary of employee being replaced.
<textarea name="ReplacementBox" cols="55" rows="5" value="N/A" disabled style="background:#dddddd"> </textarea></td>
</tr>
<tr>
<td class="tdBorder">Position Budgeted</td>
<td class="tdBorder" colspan="3"><input type="radio" name="Pbudget" value="Yes"> Yes &nbsp;&nbsp; <input type="radio" name="Pbudget" value="No"> No</td>
</tr>
<tr>
<td colspan="4">
<div align="center">
<input type="submit" value="Submit claim" class="Button" width="90px">&nbsp;&nbsp;
<input type=reset value="Reset" class="Button" width="90px">
</div></td>
</tr>
<tr>
<td colspan="4"><span class="tdBorder">
</span></td>
</tr>

</table>
</form>


<!-- End page content -->
</div>
<div class="divIntroText">Where am I? <% = BreadCrumb(Request.ServerVariables("PATH_INFO")) %></div>
<!--#include virtual="/menu/PageBottom.inc"-->
</body></html>
 
Hi HT,

thanks for you help. As suggested i've posted my code above! I am struggling with Allocation one, two and three feilds. Basically its a number feild which will hold percentage values, which will automatically will be calculated. What i want is that when a form is submitted it writes whatever is in the Allocation field to the DB. At the moment if i enter 10% its writing 1000% in DB.

All Feilds in DB are also numaric! please let me know what to do!

thanks
Tushar
 
Back
Top Bottom