Sql - insert into

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • isaace
    New Member
    • Jan 2012
    • 13

    Sql - insert into

    I have an sql statement which I was hoping someone may be able to help me with. I'm getting the following errors:
    1 - runtime error 3346 (Number of query values and destination values are not the same
    2 - Runtime Error 3075 syntax

    Code:
    strSql = "INSERT INTO tblConversation ( " & _
                    "RecordID, LeadID, Conversation, Subject, DateEntered, ContactDate, ContactTime, FollowUpDate )" & _
                    "Values (" & _
                    "'" & Me!LeadID & "', " & _
                    "'" & Me!RecordID & "', " & _
                    "'" & Me!Conversation & "', " & _
                    "'" & Me!Subject & "', " & _
                    "'" & "#" & Date & "#" & "', " & _
                    "'" & "#" & Me!ContactDate & "#" & "', " & _
                    "'" & "#" & Me!ContactTime & "#" & "', " & _
                    "'" & "#" & Me!FollowUpDate & "#" & "', " & _
                    "FROM frmTenantConvoEntry where Recordid = " & Me!RecordID
                    
    DoCmd.RunSQL (strSql)
    Please note - I am trying to pull values from a form and enter them into a table...
  • nico5038
    Recognized Expert Specialist
    • Nov 2006
    • 3080

    #2
    Best to start with printing the string in the immediate window and post it here.
    I guess something with the comma"s isn't right

    Comment

    • ucu13
      New Member
      • May 2012
      • 14

      #3
      have to look carefully as how the datatime fields is formatted. must keep in mind the regional settings from windows.you have to get this type of value"2012.05.3 0...." and i think you get "2012,05,30.... "

      Comment

      • developergarage
        New Member
        • May 2012
        • 4

        #4
        dont u think it should be 'recordId' n then 'lead ID' after 'values'....
        u r specifying table name after 'into' n also after 'from'.. where as i know insert cant have form clause with it.just confirm it

        Comment

        • Rabbit
          Recognized Expert MVP
          • Jan 2007
          • 12517

          #5
          You specified the VALUES and FROM keyword, one does not go with the other.

          Comment

          Working...