Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2005
    Posts
    7

    Unanswered: query results are read only

    i have a query to display results from a table so i can then delete them, due to relationships i cant run a delete query!
    the query is run, using a macro from my switchboard, but when i run the query in this way and try to delete a record it says i cant and that it is read only data. if i run the query by going into the menu and query section it works.
    how do i fix this? any help would be great, thanks

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Can you paste your SQL here?
    Inspiration Through Fermentation

  3. #3
    Join Date
    Feb 2005
    Posts
    7
    SELECT tblOrder.CustomerID, tblOrder.ManufacturerID, tblOrder.ModelID, tblOrder.Payment_Amount, tblOrder.Last_Payment_Date
    FROM tblModel INNER JOIN tblOrder ON (tblModel.ModelID = tblOrder.ModelID) AND (tblModel.ModelID = tblOrder.ModelID)
    WHERE (((tblOrder.Payment_Amount)=[Price]));
    here is the SQL code. hope it helps!

  4. #4
    Join Date
    Feb 2005
    Posts
    7
    o, and it only stops me deleting the records if i open the query via a macro. it it the macro that makes it read only?if i open the query manually - not with switchboard, then i can delete records so i dont think it is a problem with the query!

  5. #5
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    what do you want to delete:
    - customer ?
    - manufacturer ?
    ...probably NO, so access' obstinacy is actually helping.

    in general, DELETE and JOIN are unhappy bedmates.

    work out what you want to delete.
    use a SELECT something like your current query to grab idThisTable
    run a DELETE * FROM ThisTable WHERE idThisTable = grabbedID

    izy
    currently using SS 2008R2

  6. #6
    Join Date
    Feb 2005
    Posts
    7
    sorry i dont really understand what u mean!
    i want to delete a custoemr from the database. to do this i need to delete the entire record from tblOrder, then from tblCustomer
    i want to entirely remove customer!

  7. #7
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    before you can delete Customer you must delete any Order records that have your target customer as foreign key. you will also need to delete any records in other tables that might have your Customer as foreign key.

    maybe referential integrity with cascaded deletes could do this automatically for you (i can't comment since i don't use cascades)

    so
    DELETE * FROM tblOrders WHERE idCustomer = yourTargetCustomer
    'and repeat for any other tables using idCustomer as FK

    then
    DELETE * FROM tblCustomer WHERE idCustomer = yourTargetCustomer


    ?? are you sure this is a good decision ??
    why delete something that a user spent time and effort inserting ...consider moving the record(s) to an archive so that you can undelete when the ooooops factor cuts in.

    izy
    currently using SS 2008R2

Posting Permissions

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