Calculated fields not updating table

Gavx

Registered User.
Local time
Tomorrow, 04:50
Joined
Mar 8, 2014
Messages
155
On formA is a button that opens formB.

formB has some calculated fields whose Control Source is some fields on a sub form on formA - using the statement =[Forms]![formA]![sbfformA].[Form]![somecontrol].

And this works but those calculated fields do not update the formB's record source.

Also there is a subform on formB that contains fields that are calculated, getting their value from formA. These fields do not update the form's record source.

Any reason why this might be happening?
 
I don't see why you would expect the record source to be updated. Where in this scheme would the code know in which field in the record source the information from [Forms]![formA]![sbfformA].[Form]![somecontrol] is to go?

I think you are going to have to assign the value from [Forms]![formA]![sbfformA].[Form]![somecontrol] to the record source in code. Try doing this:

1. Put a textbox on the formB that is bound to the field in the record source you want to update, i.e., the control source of that textbox will be the field from that record source you want updated. Let's call that textB and you could hide it if you want.

2. In the after update of the sbformA. Put

[Forms][formB]!TextB = Me.SomeControl

formB will have to be open for this to work. If this doesn't work you could also try to get the primary key of the record from the formB and then do an update of formB's record source, something like

CurrentDb.Execute "UPDATE [TheNameoftheRecordSource] SET [thefieldname] = '" & Me.SomeControl & "' WHERE [PrimaryOfRecordSource] = " & [Forms]![formB]![TextboxwithPrimaryKey]
 
Last edited:
Please note that my previous post was changed.
 

Users who are viewing this thread

Back
Top Bottom