Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2003
    Posts
    43

    Unanswered: What is wrong with this command?

    Having trouble with this Update table. I have two tables one is the final table for this information the other is information pulled from a file. Now what is suppose to happen is the new information is suppose to be put into the final table where that information goes to that persons name. But the UPDATE script keeps saying their is an error. Now I have tried this in many differnt ways any help is appreciated.


    DoCmd.RunSQL "UPDATE Test SET(October_Minutes),(October)=SELECT [Minutes],[Charges]FROM Qry WHERE (User_Name FROM Test) = (User_Name FROM Qry)"

    Thanks,
    Bill

  2. #2
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    Try building the query in the QueryByExample tool then switching to the SQL view and copy that to your code. The QBE gives better errors for figuring out what is wrong than does VBA code.

  3. #3
    Join Date
    Oct 2003
    Posts
    43

    Forgot to metion

    This is in Access 2000.

  4. #4
    Join Date
    Oct 2003
    Location
    Jordan
    Posts
    28
    From the way you wrote your sql statment. I think nothing is wrong in your code, but the problem exists in your records.

    For examples you may have more than one record, Try using group by.


    Regards,

    Firas arramli

  5. #5
    Join Date
    Oct 2003
    Posts
    706

    Post

    Code:
    DoCmd.RunSQL "UPDATE Test SET(October_Minutes),(October)=SELECT [Minutes],[Charges]FROM Qry WHERE (User_Name FROM Test) = (User_Name FROM Qry)"
    In this SQL statement I do not immediately see how the computer is supposed to identify the records to be updated. The "WHERE" clause will be bound to the innermost SELECT, which is presumably a sub-select used to find the records; so the UPDATE statement doesn't have a WHERE clause.
    ChimneySweep(R): fast, automatic
    table repair at a click of the
    mouse! http://www.sundialservices.com

Posting Permissions

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