Results 1 to 4 of 4
  1. #1
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727

    append error

    all, using 2010. I am trying to run a series of appends but I running into problems. error 3134 syntax error in insert into statement:


    Code:
    sSQL1 = "INSERT INTO tblDemAdv ( ParticipantType, Relationship, ClientID, PolicyHolderID, PolicyHolderSSN, DependentID, DependentSSN " & _
    "FirstName, LastName, Address1, Address2, City, State, Zip, Phone, DateofBirth, Age, Disabled, EEType, PlanName, CoverageLevel, " & _
    "Carrier, PolicyNumber, PayPeriod, BenID, DedID, Rate,  PerPayPeriod, HisDte ) " & _
    "Select tblDemAdv_temp.[Participant Type], tblDemAdv_temp.Relationship, tblDemAdv_temp.[Client ID], " & _
    "tblDemAdv_temp.[Policy Holder ID], tblDemAdv_temp.[Policy Holder SSN], tblDemAdv_temp.[Dependent ID], " & _
    "tblDemAdv_temp.[Dependent SSN], tblDemAdv_temp.[First Name], tblDemAdv_temp.[Last Name], tblDemAdv_temp.[Address 1], " & _
    "tblDemAdv_temp.[Address 2], tblDemAdv_temp.City, tblDemAdv_temp.State, tblDemAdv_temp.Zip, tblDemAdv_temp.Phone, " & _
    "tblDemAdv_temp.[Date of Birth], tblDemAdv_temp.Age, tblDemAdv_temp.Disabled, tblDemAdv_temp.[EE Type], " & _
    "tblDemAdv_temp.[Plan Name], tblDemAdv_temp.[Coverage Level], tblDemAdv_temp.Carrier, tblDemAdv_temp.[Policy Number], " & _
    "tblDemAdv_temp.[Pay Period], tblDemAdv_temp.[Ben ID], tblDemAdv_temp.[Ded ID], tblDemAdv_temp.[ Rate*], " & _
    "tblDemAdv_temp.[ Per Pay Period], tblDemAdv_temp.HisDte, " & _
    "FROM tblDemAdv_temp;"
    It runs from the design view under queries but will not from the form. Can any one spot what's going on? Thanks

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    At first glance, it looks like you are missing a comma between the "DependentSSN" and "FirstName" fields (end of your first line, beginning of the second).

    Also, do you really have a field name [ Rate*]? Spaces and special characters like asterisks should really be avoided in object and field names.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    In addition to JoeM's comment, I see an extra comma at

    .......
    "tblDemAdv_temp.[ Per Pay Period], tblDemAdv_temp.HisDte, " & _ "FROM tblDemAdv_temp;"
    Your naming convention with embedded spaces could cause you syntax errors at some point. You'll have to enclose
    these names in square brackets -- always.

  4. #4
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Fixed the comma issue. Now getting same error "3134 Syntax error in Insert...."
    The select from table is a temp table imported in from an excel spreadsheet. I changed the field names in the perm table. Thanks

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Error Handling & Append Queries
    By DarkWolff in forum Programming
    Replies: 11
    Last Post: 04-20-2012, 03:05 PM
  2. append query error
    By kallm in forum Programming
    Replies: 0
    Last Post: 02-26-2012, 09:35 AM
  3. Append query error trapping
    By tpcervelo in forum Programming
    Replies: 4
    Last Post: 12-22-2011, 10:57 AM
  4. Append Query Error
    By lupis in forum Queries
    Replies: 1
    Last Post: 06-18-2010, 02:10 AM
  5. append query error
    By shashigk in forum Queries
    Replies: 2
    Last Post: 09-22-2009, 07:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums