Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I want to copy from a linked table and make a new table but i get the above error.Cn yo help me ?

    DoCmd.RunSQL "SELECT products.productid INTO XXX FROM products FROM products WHERE 1=2"

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts
    [quote name='freelance' post='793499' date='16-Sep-2009 19:58']I want to copy from a linked table and make a new table but i get the above error.Cn yo help me ?

    DoCmd.RunSQL "SELECT products.productid INTO XXX FROM products FROM products WHERE 1=2"[/quote]
    Try

    DoCmd.RunSQL "SELECT products.productid INTO XXX FROM products WHERE 1=2":

    The problem with this is that 1 does not equal 2 so no records will be copied.

    So try:

    DoCmd.RunSQL "SELECT products.productid INTO XXX FROM products"

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    [quote name='freelance' post='793499' date='16-Sep-2009 18:58']DoCmd.RunSQL "SELECT products.productid INTO XXX FROM products FROM products WHERE 1=2"[/quote]

    Is 1 a field name? and you want to select the records where the value of this field is 2? Otherwise explain what "where 1=2" is supposed to mean.
    Does this work?
    DoCmd.RunSQL "SELECT products.productid INTO XXX FROM products FROM products WHERE products.1=2
    Regards
    John



  4. #4
    3 Star Lounger
    Join Date
    Apr 2002
    Location
    Redditch, Worcestershire, England
    Posts
    233
    Thanks
    0
    Thanked 22 Times in 21 Posts
    This syntax works OK for me with both local and linked tables in Access 2000. Are you sure you've checked the field / table names exactly.

    (I assume you're using 1=2 to generate a FALSE condition which causes the target table to be created but with no records in it)

  5. #5
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you very much for the fine suggestions they worked and i am pleased with the results!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •