Results 1 to 2 of 2
  1. #1
    jscriptor09 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    60

    insert into error

    Hi folks

    I a have 2 tables A and B
    Table A has 2 fields:
    Date as in 01/01/2011
    YR_FW as in 2011.01

    Table B has many Fields but one of them is a Date

    Problem:
    I have a VBA to add a YR_FW field table B
    Then I do this in VBA

    "INSERT INTO B B.YR_FW Values (SELECT A.YR_FW FROM A WHERE B.Date = A.Date)"

    I keep getting this error ""Syntax error in INSERT INTO statement."
    Error number 3134

    Any idea what am I doing wrong?



    Thanks
    Mike

  2. #2
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I'm not really understanding what you are doing, but one problem is that "Date" is a reserved word in Access (and also a function name) and shouldn't be used for object names. Also, it is not very descriptive... "date" of what???

    If you must use "Date" as a field name, try enclosing it in brackets:

    Code:
    INSERT INTO B B.YR_FW Values (SELECT A.YR_FW FROM A WHERE B.[Date] = A.[Date])

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

Similar Threads

  1. INSERT query: insert new data only
    By drh in forum Access
    Replies: 2
    Last Post: 04-04-2014, 05:31 PM
  2. INSERT INTO Syntax Error
    By eww in forum Programming
    Replies: 1
    Last Post: 04-06-2011, 10:28 AM
  3. SQL INSERT INTO Date Syntax Error
    By tuna in forum Programming
    Replies: 5
    Last Post: 08-10-2010, 06:17 AM
  4. help with insert
    By jamie in forum Access
    Replies: 1
    Last Post: 11-16-2009, 06:02 AM
  5. Syntax Error In Insert Into Statement
    By frankvfox in forum Queries
    Replies: 1
    Last Post: 09-09-2008, 12:35 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