Forums
This topic is locked
80040e07 Data type mismatch in criteria expression
Posted 28 Sep 2001 11:49:14
1
has voted
28 Sep 2001 11:49:14 Kevin Abbott posted:
Hi,I have been trying to find the solutions to this error, it's driving me mad.
Heres my code:
<%@LANGUAGE="JAVASCRIPT"%>
<!--#include file="../Connections/projectstore.asp" -->
<%
// *** Edit Operations: declare variables
// set the form action variable
var MM_editAction = Request.ServerVariables("URL"
if (Request.QueryString) {
MM_editAction += "?" + Request.QueryString;
}
// boolean to abort record edit
var MM_abortEdit = false;
// query string to execute
var MM_editQuery = "";
%>
<%
// *** Insert Record: set variables
if (String(Request("MM_insert") != "undefined" {
var MM_editConnection = MM_projectstore_STRING;
var MM_editTable = "access";
var MM_editRedirectUrl = "../default.asp";
var MM_fieldsStr = "FirstName_Field|value|LastName_Field|value|Greeting_Field|value|Telephone_Field|value|DeskNo_Field|value|Username_Field|value|Password_Field|value";
var MM_columnsStr = "FirstName|',none,''|LastName|',none,''|Greeting|',none,''|Extension|',none,''|DeskNumber|',none,''|Username|',none,''|Password|',none,''";
// create the MM_fields and MM_columns arrays
var MM_fields = MM_fieldsStr.split("|"
var MM_columns = MM_columnsStr.split("|"
// set the form values
for (var i=0; i+1 < MM_fields.length; i+=2) {
MM_fields[i+1] = String(Request.Form(MM_fields[i]));
}
// append the query string to the redirect URL
if (MM_editRedirectUrl && Request.QueryString && Request.QueryString.length > 0) {
MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1)?"?":"&" + Request.QueryString;
}
}
%>
<%
// *** Insert Record: construct a sql insert statement and execute it
if (String(Request("MM_insert") != "undefined" {
// create the sql insert statement
var MM_tableValues = "", MM_dbValues = "";
for (var i=0; i+1 < MM_fields.length; i+=2) {
var formVal = MM_fields[i+1];
var MM_typesArray = MM_columns[i+1].split(","
var delim = (MM_typesArray[0] != "none" ? MM_typesArray[0] : "";
var altVal = (MM_typesArray[1] != "none" ? MM_typesArray[1] : "";
var emptyVal = (MM_typesArray[2] != "none" ? MM_typesArray[2] : "";
if (formVal == "" || formVal == "undefined" {
formVal = emptyVal;
} else {
if (altVal != "" {
formVal = altVal;
} else if (delim == "'" { // escape quotes
formVal = "'" + formVal.replace(/'/g,"''" + "'";
} else {
formVal = delim + formVal + delim;
}
}
MM_tableValues += ((i != 0) ? "," : "" + MM_columns[i];
MM_dbValues += ((i != 0) ? "," : "" + formVal;
}
MM_editQuery = "insert into " + MM_editTable + " (" + MM_tableValues + " values (" + MM_dbValues + "";
if (!MM_abortEdit) {
// execute the insert
var MM_editCmd = Server.CreateObject('ADODB.Command');
MM_editCmd.ActiveConnection = MM_editConnection;
MM_editCmd.CommandText = MM_editQuery;
MM_editCmd.Execute();
MM_editCmd.ActiveConnection.Close();
if (MM_editRedirectUrl) {
Response.Redirect(MM_editRedirectUrl);
}
}
}
%>
<html>
<head>
<title>USBW - irequire - Registration</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" src="../JS/pagereload.js" hotswap="extJs_1"></script>
<script language="JavaScript" src="../JS/findobject.js" hotswap="extJs_2"></script>
<script language="JavaScript" src="../JS/preloadimages.js" hotswap="extJs_3"></script>
<script language="JavaScript" src="../JS/validateform.js" hotswap="extJs_4"></script>
<script language="JavaScript">
<!--
function formfocus(){
document.form1.FirstName_Field.focus();
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#"!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" onLoad="MM_preloadimages('../images/navibar/pleasewait.gif');document.form1.FirstName_Field.focus()">
<div id="Layer10" style="position:absolute; width:195px; height:30px; z-index:1; left: 213px; top: 15px"><img src="../images/navibar/irequire.gif" width="200" height="30" name="irequire"></div>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<div id="Layer2" style="position:absolute; width:173px; height:33px; z-index:2; left: 12px; top: 14px"><img src="../images/navibar/logo25pt.gif" width="162" height="33" name="UBSLOGO"></div>
<div id="Layer3" style="position:absolute; width:800px; height:20px; z-index:3; left: 3px; top: 53px">
<pre> <img name="SoftRoll" border="0" src="../images/navibar/softbutover.gif" width="100" height="30" alt="You MUST login first to view this section"> <img name="HardRoll" border="0" src="../images/navibar/hardbutover.gif" width="100" height="30" alt="You MUST login first to view this section"> <img name="ServRoll" border="0" src="../images/navibar/servbutover.gif" width="155" height="30" alt="You MUST login first to view this section"> <img name="NetRoll" border="0" src="../images/navibar/netbutover.gif" width="100" height="30" alt="You MUST login first to view this section"> <img name="MDSRoll" border="0" src="../images/navibar/mdsbutover.gif" width="50" height="30" alt="You MUST login first to view this section"> <img name="BCMRoll" src="../images/navibar/bcmbutover.gif" width="50" height="30" alt="You MUST login first to view this section"><a href="javascript:;">
</a><img src="../images/navibar/blankbox.gif" width="795" height="20" name="TextBar"></pre>
</div>
<div id="Layer4" style="position:absolute; width:496px; height:157px; z-index:4; left: 225px; top: 119px; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000">
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="form1">
<div align="center">
<div align="center">
<div align="left"><font face="Arial, Helvetica, sans-serif" size="3"><b><font size="2">First
name:<br>
</font></b> <font size="2">
<input type="text" name="FirstName_Field" size="30">
</font></font><font face="Arial, Helvetica, sans-serif" size="2"><br>
<b>Last Name:<br>
</b>
<input type="text" name="LastName_Field" size="30">
<br>
<br>
</font></div>
</div>
</div>
<div align="center">
<div align="center">
<div align="left"><font face="Arial, Helvetica, sans-serif" size="2"><b>What
name would you like to be greeted as:<br>
<input type="text" name="Greeting_Field" size="30" maxlength="30">
</b>(30 characters maximum)<br>
<br>
</font></div>
</div>
</div>
<div align="center">
<div align="center">
<div align="left"><font face="Arial, Helvetica, sans-serif" size="2"><b>Telephone
Number or Extension:<br>
</b>
<input type="text" name="Telephone_Field" size="30">
<br>
<br>
</font></div>
</div>
</div>
<div align="center">
<div align="center">
<div align="left"><font face="Arial, Helvetica, sans-serif" size="2"><b>Desk
Number:<br>
<input type="text" name="DeskNo_Field" size="20" maxlength="20">
<br>
<br>
</b></font></div>
</div>
</div>
<div align="center">
<div align="center">
<div align="left">
<p><font size="2"><b><font face="Arial, Helvetica, sans-serif">Username:
(Case sensitive, 30 characters maximum)</font></b><font face="Arial, Helvetica, sans-serif"><br>
<input type="text" name="Username_Field" size="30" maxlength="30">
<br>
</font><b><font face="Arial, Helvetica, sans-serif">Password: (Case
sensitive, 30 characters maximum)</font></b><font face="Arial, Helvetica, sans-serif"><br>
<input type="password" name="Password_Field" size="30" maxlength="30">
<br>
<br>
</font></font><font face="Arial, Helvetica, sans-serif" size="2">
<input type="submit" name="Submit" value="Submit" onMouseDown="document.form1.Password_Field.blur();MM_swapImage('PleaseW','','../images/navibar/pleasewait.gif',1);MM_validateform('FirstName_Field','','R','LastName_Field','','R','Greeting_Field','','R','Telephone_Field','','R','DeskNo_Field','','R','Username_Field','','R','Password_Field','','R');placeFocus();return document.MM_returnValue;">
<input type="reset" name="Reset" value="Reset">
</font></p>
<p><img src="../images/navibar/pleasewaitoff.gif" width="100" height="20" name="PleaseW"></p>
</div>
</div>
</div>
<input type="hidden" name="MM_insert" value="true">
</form>
</div>
<div id="Layer5" style="position:absolute; width:200px; height:151px; z-index:5; left: 12px; top: 133px; background-color: #eeeeee; layer-background-color: #eeeeee; border: 1px none #000000">
<p><img src="images/RegistrationPic.jpg" width="200" height="133" name="RegPic"></p>
<p><font face="Arial, Helvetica, sans-serif" size="2">You can register here.
You will then be able to access all areas of this website.</font></p>
<p><font face="Arial, Helvetica, sans-serif" size="2">Please make sure that
you complete each field in-full and correctly so that we can process your
submission quickly.</font></p>
<p><font face="Arial, Helvetica, sans-serif" size="2">If you have come here
by mistake please <a href="../default.asp">click here</a> to go back to the
main page. </font></p>
</div>
<div id="Layer1" style="position:absolute; width:331px; height:26px; z-index:1; left: 452px; top: 8px; overflow: hidden"><a href="../default.asp"><img src="../images/navibar/ehome.gif" width="36" height="30" name="ehome" border="0"></a><img src="../images/navibar/eseparator.gif" width="7" height="30" name="seperator"><a href="../help/Genhelp.asp"><img src="../images/navibar/ehelp.gif" width="36" height="30" name="ehelp" border="0" alt="help"></a><img src="../images/navibar/eseparator.gif" width="7" height="30" name="seperator"><img src="../images/navibar/esearch.gif" width="42" height="30" name="esearch"><img src="../images/navibar/eseparator.gif" width="7" height="30" name="seperator"><img src="../images/navibar/econtact.gif" width="59" height="30" name="econtact"><img src="../images/navibar/eseparator.gif" width="7" height="30" name="seperator"><img src="../images/navibar/esitemap.gif" width="55" height="30" name="esitemap"><img src="../images/navibar/eseparator.gif" width="7" height="30" name="seperator"><img src="../images/navibar/ubswhome.gif" width="62" height="30" name="e_ubswhome"></div>
<div id="Layer6" style="position:absolute; width:200px; height:20px; z-index:6; left: 12px; top: 109px"><img src="images/RegistrationText.gif" width="129" height="23" name="RegText"></div>
</body>
</html>
My database is an excel spreadsheet with 3 worksheets contained within it.
Any help would be great.
Thanks in advance
Replies
Replied 28 Sep 2001 17:49:39
28 Sep 2001 17:49:39 Viktor Farcic replied:
You haven't specified what the problem is.
P.S. Use DB like Access for storing data, unless there is very good reason for Excell.
Edited by - vfarcic on 09/28/2001 17:50:27
P.S. Use DB like Access for storing data, unless there is very good reason for Excell.
Edited by - vfarcic on 09/28/2001 17:50:27
Replied 01 Oct 2001 09:57:06
01 Oct 2001 09:57:06 Kevin Abbott replied:
Sorry, it's that every time the pagee loads I get error:
80040e07 Data type mismatch in criteria expression.
I'm only using excel as my db because I can't get hold of access at the moment.
80040e07 Data type mismatch in criteria expression.
I'm only using excel as my db because I can't get hold of access at the moment.
Replied 01 Oct 2001 11:10:40
01 Oct 2001 11:10:40 Kevin Abbott replied:
Right,
I seemed to of fixed the problem.
I took out the underscores from my form field names (Greet_Field now GreetingField, etc. why this fixed it I do not know?!?!?!)
But now I have a problem reading the data back in in certain places.
To use my spreadsheet I need to name sheets within the spread sheet (e.g (within Excel) highlight area to be save/read from, goto Insert -> Name -> Define.
The problem I'm having is when an entry is inserted into the spreadsheet it goes out of scope of the named section. So if say I had =Sheet1!$A$1:$G$6 (named) the next time I use insert record the value would be entered at row 7.
This causes problems because when I want to display these values using dynamic text within Ultradev, Ultradev can't find them because it's only searching the spreadsheet within =Sheet1!$A$1:$G$6.
I'll write this as a seperate post but any help would be great.
Thanks.
I seemed to of fixed the problem.
I took out the underscores from my form field names (Greet_Field now GreetingField, etc. why this fixed it I do not know?!?!?!)
But now I have a problem reading the data back in in certain places.
To use my spreadsheet I need to name sheets within the spread sheet (e.g (within Excel) highlight area to be save/read from, goto Insert -> Name -> Define.
The problem I'm having is when an entry is inserted into the spreadsheet it goes out of scope of the named section. So if say I had =Sheet1!$A$1:$G$6 (named) the next time I use insert record the value would be entered at row 7.
This causes problems because when I want to display these values using dynamic text within Ultradev, Ultradev can't find them because it's only searching the spreadsheet within =Sheet1!$A$1:$G$6.
I'll write this as a seperate post but any help would be great.
Thanks.