Results 1 to 5 of 5
  1. #1
    fluppe is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    48

    query syntax,

    Hi everybody,

    i have a problem trying something ...
    It is the following SQL i want to execute from VBA:

    Code:
    SELECT tbl_Tmp_Conditions.ID, tbl_Tmp_Conditions.ConditionName
     INTO tbl_Conditions.ConditionID, ConditionName 
    FROM tbl_Tmp_Conditions  
    WHERE tbl_Tmp_Conditions.check = Yes
    It is my effort set entries into a table that are copies of entries from another table. But i do not want to copy the whole record, only two fields.
    I'm not sure if that can work in this way.
    However, something is wrong with this SQL code:

    Run Time Error : -2147467259 (80004005)
    Query input must contain at least one table


    I don't know whats wrong however and i would greatly appreciate any hints. Maybe it is the way i try to run this query ?


    Thanks for reading this post,

    ....

  2. #2
    fluppe is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    48
    Ok, i got the first flaw i think ... it is not possible to specify the fields of the target table, right ?
    Well then, does the target table have to be empty ?

  3. #3
    fluppe is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    48
    OK, it works with

    Code:
    SELECT tbl_Tmp_Conditions.ID, tbl_Tmp_Conditions.ConditionName
     INTO tbl_Conditions
    FROM tbl_Tmp_Conditions  
    WHERE tbl_Tmp_Conditions.check = Yes
    if tbl_Conditions does not exist. That is a problem however, because I'd like to have an existing table ...
    Is it possible by means of SQL to add records to an existing table in which the content (as described above) from another table is copied ?

    Kind Regards,

    ....

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    fluppe is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    48

    well ...

    Hello,
    Found (nearly) that in the Doc:

    Code:
    "INSERT INTO  tbl_Conditions (ConditionNumber, ConditionName) SELECT  tbl_Tmp_Conditions.ID, tbl_Tmp_Conditions.ConditionName FROM  tbl_Tmp_Conditions WHERE tbl_Tmp_Conditions.check = Yes"
    Thanks a lot for your help .... i'm looking for the solved button once more.

    Yours,

    ...

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

Similar Threads

  1. query syntax
    By ivor in forum Queries
    Replies: 9
    Last Post: 06-13-2013, 02:12 AM
  2. Query Syntax
    By dolovenature in forum Access
    Replies: 1
    Last Post: 08-29-2012, 06:54 PM
  3. Incomplete Syntax Clause (syntax error)
    By ajetrumpet in forum Programming
    Replies: 4
    Last Post: 09-11-2010, 10:47 AM
  4. UPDATE query syntax
    By jgelpi16 in forum Programming
    Replies: 10
    Last Post: 08-21-2010, 07:40 PM
  5. Sql Syntax Query
    By Matthieu in forum Queries
    Replies: 4
    Last Post: 12-30-2009, 09:41 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