Error: you can't assign a value to this object

Katy

Registered User.
Local time
Today, 16:28
Joined
Mar 16, 2007
Messages
13
I have a form based on a query for viewing and entering data. It is a stock form and I have three fields from the query (Order value, Shipping Supplement and Postage) which are totalled into a Total Cost field. If I try to change one of the values I get an error message saying "you can't assign a value to this object", I close the VB window and everything has actually updated properly. How do I stop the error message as nothing seems to be wrong?

The code for the calculated field is:

Private Sub OrderValue_AfterUpdate()

Me![Amountpaid] = (Me![OrderValue] + Me![ShippingSupplement] + Me![Postage])

End Sub
Private Sub ShippingSupplement_AfterUpdate()

Me![Amountpaid] = (Me![OrderValue] + Me![ShippingSupplement] + Me![Postage])

End Sub
Private Sub Postage_AfterUpdate()

Me![Amountpaid] = (Me![OrderValue] + Me![ShippingSupplement] + Me![Postage])

End Sub



And I have =[OrderValue]+[ShippingSupplement]+[Postage] as the source
 
You can't update the value of a calculated control like that. Since it has that calculation, it should update itself when the other values change.
 
Hi Thanks for having a look. I tried to change the postage field rather than the calculated field, should I be unable to do that?
 
I'm not clear on what you're saying. You should be able to change the value in the postage field (or the other 2). You don't need any of that code to update the amount paid control. Since it has that calculation, it should update itself.
 
I had got to the point where I had over-complicated things to such an extend that I think it gave up on me! Have removed all the coding and it's fine now.

:)
 

Users who are viewing this thread

Back
Top Bottom