By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,454 Members | 3,133 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,454 IT Pros & Developers. It's quick & easy.

Microsoft JET Database Engine error

P: 1

I am getting the following error on my code:

Microsoft JET Database Engine error '80040e07'
Data type mismatch in criteria expression.

Personeelsnummer.Asp, line 220

The code.

Expand|Select|Wrap|Line Numbers
  1.     <%
  2.         Set oRs=Server.CreateObject("adodb.recordset")
  3.         Pn=Request("ZoekPersNr")
  4.         strSQL = "SELECT P_Tussenvoegsel, P_Achternaam FROM tbl_peroonsgegevens_zld WHERE PersNr= '" & Pn & "'"
  5.         oRs.Open strSQL, MyConn
  6.         if NOT oRs ("P_Achternaam") = " " then
  7.               Response.Write "<tr><td><font size=""2"" face=""Verdana""><b>Partnernaam</font></b></td><td height=""20""><font size=""2"">"&  oRs ("P_Tussenvoegsel")& " "&  oRs ("P_Achternaam") &"</font></td> </tr>"
  8.         end if
  9.     %>    

Its a MSaccess 2003 database and frontpage 2003 website.

Line 220 is
Expand|Select|Wrap|Line Numbers
  1. oRs.Open strSQL, MyConn
Many Thanks.
May 29 '12 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 634

I'm just guessing but I suspect that PersNr is a numeric field; if so then change you sql to
Expand|Select|Wrap|Line Numbers
  1. strSQL = "SELECT P_Tussenvoegsel, P_Achternaam FROM tbl_peroonsgegevens_zld WHERE PersNr= " & Pn 
ie. remove th apostrophies, there are only require for text fields.


May 29 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.