Results 1 to 7 of 7
  1. #1
    jax1000rr is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    26

    Need help with an INSERT query with a WHERE statement

    Getting Run-time error 3067 with the following SQL, any help is appreciated:



    Code:
    "SELECT MasterList.FileNumber AS Value1, Now() AS Value2, fOSUsername() AS Value3, 'User Notified' AS Value4, 'User notified of completion.' AS Value5" & _
    "FROM tblCommLog, MasterList WHERE (((MasterList.DateSentToVendor)= & [Forms]![frmUserNotifications]![DateSentToVendor] & AND ((MasterList.CurrentWF)=DRDO()));"

  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,518
    You're not ending/restarting the string around the form references:

    "Blah Blah " & FormReferences & " More here"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    Where is the INSERT part of the Insert query?
    Where and how do you run this query?
    Why all the as Value As..?

    Perhaps you should research Join or Inner Join. Or put some more context around your question.

  4. #4
    jax1000rr is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    26
    Still getting the error, am I missing something else, revise SQL below:

    Code:
    DoCmd.RunSQL "INSERT INTO tblCommLog ( FileNumber, Date_Time, User, Comm_Subject, Content )" & _
    "SELECT MasterList.FileNumber AS Value1, Now() AS Value2, fOSUsername() AS Value3, 'User Notified' AS Value4, 'User notified of completion' AS Value5" & _
    "FROM tblCommLog, MasterList WHERE (((MasterList.DateSentToVendor)= " & [Forms]![frmUserNotifications]![DateSentToVendor] & " AND ((MasterList.CurrentWF)=DRDO()));"

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    I use this technique to debug SQL:

    http://www.baldyweb.com/ImmediateWindow.htm

    Offhand, you're not including spaces between lines.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    Join Date
    Mar 2013
    Posts
    1
    Great I got it.....

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    No problem.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Insert Into statement
    By TimMoffy in forum Programming
    Replies: 7
    Last Post: 07-13-2012, 07:10 AM
  2. Replies: 4
    Last Post: 04-25-2012, 08:14 PM
  3. Insert statement
    By crowegreg in forum Programming
    Replies: 2
    Last Post: 08-19-2011, 02:20 PM
  4. Help about access INSERT INTO statement
    By ducthang88 in forum Programming
    Replies: 7
    Last Post: 12-03-2010, 08:40 AM
  5. Replies: 4
    Last Post: 09-03-2010, 02:55 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