Subform problems

J

Joan

Hi,

I have a main form (EditDeleteInvoice) with several subforms on it where
the user can edit invoices. One of the subforms,(InvoiceDetailsSubEdit),
lists other service charges for the invoice and has a control in the subform
footer called ExtendedPriceSum where the charges are totaled. The control
source for this control is:
=IIf(Forms!EditDeleteInvoice!InvoiceDetailsSubEdit.Form.RecordsetClone.Recor
dCount=0, 0, Sum([ExtendedPrice]))

I use the above line to check and see if there are any records in this
subform and if not set the control to 0. I subsequently use the value in
this total control to add to other subform totals to arrive at the
InvoiceTotal on the main form.

My problem occurs when the user attempts to add a new record to the subform
by putting a value in the control, cboChargeCode. When this is attempted,
the user gets the message: "Field cannot be updated", even though the
subform does allow the record to be added. No other user is using the record
or table. This has only started happening since I put the above line as the
control source for ExtendedPriceSum in the subform footer. Before I had it
= Sum([ExtendedPrice]). ExtendedPrice is a field expression in the
underlying query of the subform. ExtendedPrice: ([Quantity] * [UnitPrice])
How can I keep this message from appearing?? The field is actually updated
in Access 2000, but may not be allowed to be updated in Access 2003 when I
install it in the customer's computer.

Any suggestions will be appreciated.

Joan
 
T

Ted Allen

Hi Joan,

Not sure why that formula would cause a problem, but you
may be able to achieve the same result by using the Nz()
function instead of the iif() statement. Nz() will
evaluate a result and if it is null it will convert it to
0. I haven't actually tried using this in the context of
a subform formula, but I would expect that it may work.

Try, Nz(Sum([ExtendedPrice]),0)

-Ted Allen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top