Query input must contain at least one table or query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rinu911
    New Member
    • Dec 2009
    • 2

    Query input must contain at least one table or query

    hi all

    I am tring to insert a values to a table by checking if the value is there in the table already

    but it gives me this error

    "Query input must contain at least one table or query"

    here is my query

    insert into details values('6025',' 12/21/2009',' 9:07:57 AM','HP.Color_L aserJet_555_PCL _6','2','Docume nt 3, dotNET Size in bytes: 192548; pages printed: 2')
    where details.Date1 not in ( select Date1 from details where details.Date1 = '12/21/2009') AND details.Time not in ( select Time from details where details.Time = ' 9:07:57 AM')
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    You can't use a WHERE clause in an INSERT statement.

    Comment

    • rinu911
      New Member
      • Dec 2009
      • 2

      #3
      hi thanks for the replay

      is there any other alterative for this

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        DLookup() is normally used to check for values in a query or table. You can use an If...Then construct to see if the record already exists before trying to create the new record. DLookup() can have a two part Criteria.

        Welcome to Bytes!

        Linq ;0)>

        Comment

        Working...