Link to home
Start Free TrialLog in
Avatar of Gerhardpet
GerhardpetFlag for Canada

asked on

Update view in PostgreSQL and use view in Access to update

I have created a view in PosgreSQL with the following update rule

CREATE OR REPLACE RULE "_UPDATE" AS
    ON UPDATE TO custom.qty_brk_price DO INSTEAD  UPDATE inventory_price_matrix SET amount = new.amount
   FROM inventory_price_matrix ipm
     JOIN custom.qty_brk_price ON ipm.part_no::text = qty_brk_price.part_no::text
  WHERE inventory_price_matrix.part_no::text = new.part_no::text AND inventory_price_matrix.whse::text = '00'::text AND inventory_price_matrix.promo_code::text = 'BV_QTYBRK'::text AND inventory_price_matrix.amount_type::text = 'P'::text AND inventory_price_matrix.uom_code::text <> ''::text AND qty_brk_price.qty_brk_price = old.qty_brk_price AND inventory_price_matrix.min_qty = old.min_qty;

Open in new window


It works to run the following update query on the view in PostgreSQL but not in Microsoft Access when running the same query

UPDATE custom.qty_brk_price SET amount = 139
WHERE part_no='10006';

Open in new window


Can someone help on why that same query would not work in Access when linking to that view in PostgreSQL?

In Access I get this error
User generated image
Avatar of Bill Prew
Bill Prew

There are a number of reasons this can happen from Access.  Rather than try and restate them here (and I know I don't know them all) I've included a couple of links at the bottom of this comment with useful info.

One thing I would ask is when you configured the ODBC connection that you are using from Access to PostgreSQL did you mark it as read only, if so that will be a problem.  Also, does the user that you are connecting with have update access to the database / tables?



»bp
ASKER CERTIFIED SOLUTION
Avatar of Gerhardpet
Gerhardpet
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Gerhardpet

ASKER

Found our own solution