I cant enter enter new records in my order detail query SQL: SELECT OrderDetailT.OrderDetailID, ProductT.ProductName, ProductT.ProductPrice, OrderDetailT.Quantity, [ProductPrice]*[Quantity] AS PriceExTax, IIf([IsTaxble],Round([PriceExTax]*0.2,2),0) AS TaxPrice, [PriceExTax]+[TaxPrice] AS PriceInclTax FROM ProductT INNER JOIN OrderDetailT ON (ProductT.PoductID = OrderDetailT.ProductID) AND (ProductT.PoductID = OrderDetailT.ProductID);
Your parent form should only be based on the OrderT table, or a query that uses only fields from the OrderT. Your subform would be based on the OrderDetailT or the OrderDetailQ which has only fields from the OrderDetailT on it. You can't join them both together like that and expect to be able to EDIT the records. VIEW them, sure.
Is there a typo in ProductT.PoductID? Should PoductID be ProductID?
Abraham BreuerOP
@Reply 6 years ago
By bringing in the OrderDetail* in the query and then bringing in the unit price from productT will go? that's how you made it, and it works beautifully!
OK. That helps. It's been so many YEARS since I recorded these classes (7 years in this case) that sometimes I need to go back and review what I did so I can help you. In this case, I'm pulling product info into the order detail info so we can display the product name and calculate pricing. In this case, you SHOULD be able to edit the LEFT side of the query. The OrderDetailT fields should still be editable, but not the right side (the product info). That's normal behavior. Like Alex said, check your spelling, you do have ProductID spelled wrong in your Product Table, but you also have that join in there TWICE, which you shouldn't. That could be causing your problem. Get rid of the "AND" and everything after it.
Oh, and don't get too attached to the way the database is built right now. Remember, this is a TEACHING database. I show you a much better way to manage all of this by the time we get to Expert 22 and we FIX it.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Access Expert 8.