I have checked the DB.MDB which is located in admin\db.mdb Table Name: Enquiry Field Names Below -------------------- NewEnquiryID < Auto Number EnquirtyType FName LName Telephone Time EmailAddress DateFrom Nights Adults Child Notes DateSent I keep getting the following error message this works with out he DB Insert form. <% dim FName dim LName dim EnquiryType dim Telephone dim Time dim EmailAddress dim DateFrom dim Nights dim Adults dim Child dim notes dim DateSent FName=request.form("FName") LName=request.form("LName") EnquiryType=request.form("EnquiryType") Telephone=request.form("Telephone") Time=request.form("Time") EmailAddress=request.form("EmailAddress") DateFrom=request.form("DateFrom") Nights=request.form("Nights") Adults=request.form("Adults") Child=request.form("Child") notes=request.form("notes") DateSent=request.form("DateSent") Set db = Server.CreateObject("ADODB.Connection") db.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("admin\db.mdb") & ";" db.execute("INSERT INTO Enquiry ([FName], [LName], [EnquiryType], [Telephone], [Time], [EmailAddress], [DateFrom], "&_ "[Nights], [Adults], [Child], [Notes], [DateSent]) VALUES ('" & FName & "','" & LName & "','" & EnquiryType & "','"&_ Telephone & "','" & Time & "','" & EmailAddress & "','" & DateFrom & "','" & Nights & "','" & Adults & "','" &_ Child & "','" & notes & "','" & DateSent & "')") db.close set db=nothing Code (markup): Microsoft JET Database Engine error '80040e07' Data type mismatch in criteria expression. /james/send.asp, line 32 Line 32 is db.execute("INSERT INTO Enquiry ([FName], [LName], [EnquiryType], [Telephone], [Time], [EmailAddress], [DateFrom], "&_ "[Nights], [Adults], [Child], [Notes], [DateSent]) VALUES ('" & FName & "','" & LName & "','" & EnquiryType & "','"&_ Telephone & "','" & Time & "','" & EmailAddress & "','" & DateFrom & "','" & Nights & "','" & Adults & "','" &_ Child & "','" & notes & "','" & DateSent & "')") Code (markup):
Can you please give us more details regarding all fields DataType which appears in Database. Open your Access database, and tell us all field types (ex: varchars, integers, numbers, decimals, chars etc...) The error appears when the query is sent to db to be executed, so ... it miss matches. Have you tested the same Query in the database? Please reply back... Hajan
I believe you are using Integer for the "nights, adults, and child" fields. Try to remove the quotes on them.
Here are the possible DataTypes of the following columns... NewEnquiryID < Auto Number (int) EnquirtyType (int) FName (varchar) LName (varchar) Telephone (number) Time (DateTime) EmailAddress (varchar) DateFrom (DateTime) Nights (int or varchar) Adults (int or varchar) Child (int or varchar) Notes (text or varchar) DateSent (DateTime) ------------------------------------------- Now we wait to see your real DataTypes... I will propose u to use StoredProcedure in order to avoid such quotation mess ups.. So, we are waiting for reply from @james6380
Dear Friend, You can not user time as field name, Because time is the data type. you change the filed name time. It will work.
Directly under the line DateSent=request.form("DateSent") copy and paste the following: Response.Write("INSERT INTO Enquiry ([FName], [LName], [EnquiryType], [Telephone], [Time], [EmailAddress], [DateFrom], "&_ "[Nights], [Adults], [Child], [Notes], [DateSent]) VALUES ('" & FName & "','" & LName & "','" & EnquiryType & "','"&_ Telephone & "','" & Time & "','" & EmailAddress & "','" & DateFrom & "','" & Nights & "','" & Adults & "','" &_ Child & "','" & notes & "','" & DateSent & "')") Response.End Then copy/paste the SQL statement displayed into an Access query. It will probably give a better clue to the error. -Jim