Syntax error

Results 1 to 4 of 4

Thread: Syntax error

  1. #1
    Join Date
    Dec 1969

    Default Syntax error

    Hi could somebody help me out i am getting data type mismatch<BR>in insert into statement.Here is the code and after that the error message i am getting.<BR><BR>if P1 &#060;&#062; "NA" then<BR>sql = "INSERT INTO EmpTrans (User_Name, sDate, Activity, Duration, Reviewed, Process_id)" <BR>sql = sql & " VALUES(&#039" & session("auser_name") & "&#039, &#039" & strTemp & "&#039, &#039" & p1 & "&#039, &#039" & t1 & "&#039, &#039" & level1 & "&#039, &#039" & review1 &"&#039)"<BR>response.write sql<BR>Con.Execute sql<BR>response.write("Record Inserted ")<BR>end if<BR><BR>Here the error<BR>INSERT INTO EmpTrans (User_Name, sDate, Activity, Duration, Reviewed, Process_id) VALUES(&#039Ashisha&#039, &#039 1/1/00&#039, &#039Timesheets&#039, &#039 10hrs&#039, &#039 4.0 Development&#039, &#039No&#039) <BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e07&#039 <BR><BR>[Microsoft][ODBC Microsoft Access 97 Driver] Data type mismatch in criteria expression. <BR>

  2. #2
    delita Guest

    Default RE: Syntax error

    Make sure duration is a varchar (some kind of string) field. It might be that you&#039re trying to put "hr" into a numeric field.

  3. #3
    Join Date
    Dec 1969

    Default RE: Syntax error

    Data Type mismatches can be many things but usualy they are caused on the database end. You are trying to put a value into a database field and that field is not set to accept those values.<BR><BR>Here is how you check. Remove on field at a time from your INSERT statement. If you get the same error then you know that field was not the problem. Place that field back in your statement and remove the next one. <BR><BR>Eventually you will find it. I imagine though the first field you should check is the Date. That&#039s what kills me everytime.

  4. #4
    jeffwilson Guest

    Default RE: Syntax error

    Usually the date for me too!<BR><BR>Easiest way to do current date:<BR><BR>set default date value in Access to Now(). I&#039ve never figured out how to insert a date into the table!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts