Results 1 to 3 of 3
  1. #1
    Janoose is offline Novice
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    7

    Run-time Error 3067 - Query input must contain at least one table or query

    Sorry for the long title. This is my code
    Code:
      
    sqlString2 = "insert into centres (Ethics_Renew_Date) values ('" & renewDate & "') where CENTRE_CODE = '" & centreCode & "'"
    DoCmd.SetWarnings False
    Debug.Print sqlString2
    DoCmd.RunSQL sqlString2
    The debug.print outputs this:
    insert into centres (Ethics_Renew_Date) values ('2012-05-27') where centre_code = '999-999'

    Table is correct called Centres, and the field name Ethics_Renew_Date and centre_code I copied right out of my table so spelling is correct.



    When I took out where CENTRE_CODE = '" & centreCode & "'" the code works
    Last edited by Janoose; 05-27-2011 at 05:56 AM.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You can't have a WHERE clause with a VALUES clause (you could use it with a SELECT clause). A VALUES clause by definition only inserts a single record, so a WHERE clause would be meaningless anyway.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Janoose is offline Novice
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    7
    Yes I should have used Update instead of Insert in order to use Where.

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

Similar Threads

  1. Replies: 0
    Last Post: 02-22-2011, 04:18 PM
  2. Replies: 10
    Last Post: 02-02-2011, 05:48 PM
  3. Table Values As Query Input?
    By joolio in forum Access
    Replies: 2
    Last Post: 01-05-2010, 07:32 AM
  4. Replies: 0
    Last Post: 12-21-2009, 12:15 AM
  5. Creating input box for query
    By dcecil in forum Queries
    Replies: 1
    Last Post: 06-23-2009, 10:08 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