Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Error '80040e07'


Message #1 by "Mark MacInnes" <mark.macinnes@l...> on Tue, 3 Dec 2002 21:19:31
In this code I want to update a mixture of datatypes - date, number & 
strings. I have declared explicitly that the which variant the variables 
are, but i keep getting this error:

<---- END ---->
Microsoft OLE DB Provider for ODBC Drivers error '80040e07' 

[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria 
expression.

/AAD_Network/Friends/profile/my_profile2.asp, line 26 

<---- END ---->

This is my script:

<---- START ---->
Line No.s
12>       datDOB = Request.Form("dob")
          datDOB = Cdate(datDOB)
          strStarSign = Request.Form("starsign")
15>       intAge = Request.Form("age")
          intAge = Cint(intAge)
          memInterests = Request.Form("interests")
          memWhatDoing = Request.Form("whatdoing")
          strInstitution = Request.Form("institution")
20>       strQuote = Request.Form("quote")
          %>
          <%
          DIM mySQL,objRS
          mySQL = "SELECT * FROM profile WHERE userID = "&strCookie&""
25>       Set objRS = Server.CreateObject("ADODB.Recordset")
26>>>     objRS.Open mySQL,MM_th2b_members_STRING,3,3

          objRS.MoveFirst
          objRS.Update
30>       objRS("dob") = datDOB
          objRS("starSign") = strStarSign
          objRS("age") = intAge
          objRS("Interests") = memInterests
          objRS("WhatDoing") = memWhatDoing
35>       objRS("Institution") = strInstitution
          objRS("Quote") = strQuote
          objRS.Close
38>       Set objRS = Nothing
<---- END ---->

Anyone know why?

Thanks in advance!!!
Mark MacInnes
Message #2 by "Ken Schaefer" <ken@a...> on Wed, 4 Dec 2002 12:45:52 +1100
http://www.adopenstatic.com/faq/80040e07.asp

Also, you have the call to .Update in the wrong place in your code. It needs
to be called once you've set all the new values:

objRS.Open ...
objRS("dob") = datDOB
objRS("starSign") = strStarSign
objRS("age") = intAge
objRS("Interests") = memInterests
objRS("WhatDoing") = memWhatDoing
objRS("Institution") = strInstitution
objRS("Quote") = strQuote
objRS.Update  ' <-- MOVED TO HERE
objRS.Close
Set objRS = Nothing

Also, drop the call to objRS.Movefirst, it's not doing anything, except
tying up server resources...

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Mark MacInnes" <mark.macinnes@l...>
Subject: [access_asp] Error '80040e07'


: In this code I want to update a mixture of datatypes - date, number &
: strings. I have declared explicitly that the which variant the variables
: are, but i keep getting this error:
:
: <---- END ---->
: Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
:
: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria
: expression.
:
: /AAD_Network/Friends/profile/my_profile2.asp, line 26
:
: <---- END ---->
:
: This is my script:
:
: <---- START ---->
: Line No.s
: 12>       datDOB = Request.Form("dob")
:           datDOB = Cdate(datDOB)
:           strStarSign = Request.Form("starsign")
: 15>       intAge = Request.Form("age")
:           intAge = Cint(intAge)
:           memInterests = Request.Form("interests")
:           memWhatDoing = Request.Form("whatdoing")
:           strInstitution = Request.Form("institution")
: 20>       strQuote = Request.Form("quote")
:           %>
:           <%
:           DIM mySQL,objRS
:           mySQL = "SELECT * FROM profile WHERE userID = "&strCookie&""
: 25>       Set objRS = Server.CreateObject("ADODB.Recordset")
: 26>>>     objRS.Open mySQL,MM_th2b_members_STRING,3,3
:
:           objRS.MoveFirst
:           objRS.Update
: 30>       objRS("dob") = datDOB
:           objRS("starSign") = strStarSign
:           objRS("age") = intAge
:           objRS("Interests") = memInterests
:           objRS("WhatDoing") = memWhatDoing
: 35>       objRS("Institution") = strInstitution
:           objRS("Quote") = strQuote
:           objRS.Close
: 38>       Set objRS = Nothing
: <---- END ---->
:
: Anyone know why?
:
: Thanks in advance!!!
: Mark MacInnes
:

Message #3 by "Mark MacInnes" <mark.macinnes@l...> on Wed, 4 Dec 2002 10:39:09
I've changed my code like you said, but still have the same error. in the 
database, the field 'dob' is set as date/time, the field 'age' is set as 
number. all of the rest are just text fields.

Anyone know why it's not working?

Thanks
Mark

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> http://www.adopenstatic.com/faq/80040e07.asp

Also, you have the call to .Update in the wrong place in your code. It 
needs
to be called once you've set all the new values:

objRS.Open ...
objRS("dob") = datDOB
objRS("starSign") = strStarSign
objRS("age") = intAge
objRS("Interests") = memInterests
objRS("WhatDoing") = memWhatDoing
objRS("Institution") = strInstitution
objRS("Quote") = strQuote
objRS.Update  ' <-- MOVED TO HERE
objRS.Close
Set objRS = Nothing

Also, drop the call to objRS.Movefirst, it's not doing anything, except
tying up server resources...

Cheers
Ken
Message #4 by "Ken Schaefer" <ken@a...> on Thu, 5 Dec 2002 10:22:34 +1100
Hi Mark,

There are two issues with the code you presented.

The first is explained on the page I posted. It pertains to the following
SQL statement:

mySQL = "SELECT * FROM profile WHERE userID = "&strCookie&""

which is using incorrect delimiters.

There was a second issue with your code (hence the use of the word
"Also..."), which was that the .Update() call was in the wrong place. That
doesn't have anything to do with the error you were getting. It's just
something else that I noticed.

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Mark MacInnes" <mark.macinnes@l...>
Subject: [access_asp] Re: Error '80040e07'


: I've changed my code like you said, but still have the same error. in the
: database, the field 'dob' is set as date/time, the field 'age' is set as
: number. all of the rest are just text fields.
:
: Anyone know why it's not working?
:
: Thanks
: Mark
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: > http://www.adopenstatic.com/faq/80040e07.asp
:
: Also, you have the call to .Update in the wrong place in your code. It
: needs
: to be called once you've set all the new values:
:
: objRS.Open ...
: objRS("dob") = datDOB
: objRS("starSign") = strStarSign
: objRS("age") = intAge
: objRS("Interests") = memInterests
: objRS("WhatDoing") = memWhatDoing
: objRS("Institution") = strInstitution
: objRS("Quote") = strQuote
: objRS.Update  ' <-- MOVED TO HERE
: objRS.Close
: Set objRS = Nothing
:
: Also, drop the call to objRS.Movefirst, it's not doing anything, except
: tying up server resources...
:
: Cheers
: Ken


  Return to Index