Results 1 to 4 of 4
  1. #1
    stildawn is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Oct 2013
    Posts
    185

    Run Time Error 3352 - No destination field name in INSERT INTO statement (Now())


    Hi All

    I am getting this error in one of my VBA SQL codes:

    Run Time Error 3352 - No destination field name in INSERT INTO statement (Now())

    It occurs on this line:

    Code:
    CurrentDb.Execute "INSERT INTO FRT_Additionals_Table SELECT FRT_Additionals_Import_Table.Carrier, FRT_Additionals_Import_Table.[20GP BAF], FRT_Additionals_Import_Table.[40GP BAF], FRT_Additionals_Import_Table.[40HC BAF], FRT_Additionals_Import_Table.[20GP GRI], FRT_Additionals_Import_Table.[40GP GRI], FRT_Additionals_Import_Table.[40HC GRI], FRT_Additionals_Import_Table.[20GP PSS], FRT_Additionals_Import_Table.[40GP PSS], FRT_Additionals_Import_Table.[40HC PSS], FRT_Additionals_Import_Table.[20GP MISC], FRT_Additionals_Import_Table.[40GP MISC], FRT_Additionals_Import_Table.[40HC MISC], FRT_Additionals_Import_Table.[Valid From], FRT_Additionals_Import_Table.[Valid To], FRT_Additionals_Import_Table.Notes, Now() FROM FRT_Additionals_Import_Table;", dbFailOnError + dbSeeChanges
    Here is the line again with line breaks for easier reading:

    Code:
    CurrentDb.Execute 
    "INSERT INTO FRT_Additionals_Table 
    SELECT FRT_Additionals_Import_Table.Carrier, 
    FRT_Additionals_Import_Table.[20GP BAF], 
    FRT_Additionals_Import_Table.[40GP BAF], 
    FRT_Additionals_Import_Table.[40HC BAF], 
    FRT_Additionals_Import_Table.[20GP GRI], 
    FRT_Additionals_Import_Table.[40GP GRI], 
    FRT_Additionals_Import_Table.[40HC GRI], 
    FRT_Additionals_Import_Table.[20GP PSS], 
    FRT_Additionals_Import_Table.[40GP PSS], 
    FRT_Additionals_Import_Table.[40HC PSS], 
    FRT_Additionals_Import_Table.[20GP MISC], 
    FRT_Additionals_Import_Table.[40GP MISC], 
    FRT_Additionals_Import_Table.[40HC MISC], 
    FRT_Additionals_Import_Table.[Valid From], 
    FRT_Additionals_Import_Table.[Valid To], 
    FRT_Additionals_Import_Table.Notes, 
    Now() 
    FROM FRT_Additionals_Import_Table;", dbFailOnError + dbSeeChanges
    The Now() is a timestamp for when this code runs, it goes into the "Lastmodified" field in FRT_Additionals_Table.

    As far as I can tell it should work and line up, pics below of both tables structure:

    Click image for larger version. 

Name:	FRT_Additionals_Table.PNG 
Views:	26 
Size:	20.0 KB 
ID:	45204Click image for larger version. 

Name:	FRT_Additionals_Import_Table.PNG 
Views:	26 
Size:	18.7 KB 
ID:	45205

    Any help would be greatly appreciated.

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,788
    It's kind of right there in the message. You haven't identified any fields that will receive the data, and the number of target fields has to be the same as the number of source fields. If this is not a make table query (i.e Select Into...) then see

    https://docs.microsoft.com/en-us/off...oft-access-sql

    When I have many repeats of a long table name I always use table alias name.

    Code:
    Select T1.this, T1.that, etc. FROM tblWithAVeryLongNameThatIProbablyShouldHaveavoidedInTheFirstPlace AS T1...
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,405
    Only change necessary, I think, next to last line:

    Now() as LastModified

  4. #4
    stildawn is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Oct 2013
    Posts
    185
    Quote Originally Posted by Micron View Post
    It's kind of right there in the message. You haven't identified any fields that will receive the data, and the number of target fields has to be the same as the number of source fields. If this is not a make table query (i.e Select Into...) then see

    https://docs.microsoft.com/en-us/off...oft-access-sql

    When I have many repeats of a long table name I always use table alias name.

    Code:
    Select T1.this, T1.that, etc. FROM tblWithAVeryLongNameThatIProbablyShouldHaveavoidedInTheFirstPlace AS T1...
    Ah I see what happened

    Quote Originally Posted by davegri View Post
    Only change necessary, I think, next to last line:

    Now() as LastModified
    Yep that is all that was needed, thanks

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

Similar Threads

  1. Replies: 4
    Last Post: 03-26-2019, 02:40 PM
  2. Replies: 9
    Last Post: 02-02-2016, 06:27 AM
  3. Replies: 1
    Last Post: 12-30-2013, 09:11 AM
  4. Replies: 19
    Last Post: 08-08-2013, 01:17 PM
  5. Syntax Error: Insert Into statement in VBA
    By Kimbertha in forum Programming
    Replies: 1
    Last Post: 07-24-2012, 05:02 PM

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