Changing a value on a parent form from values on a subform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm attempting to change the status of a record on the main form to "Closed"
based on two values entered on a continuous subform. Here's the code, which
is generating a "recordset not updateable" error.

If Me.[cboDPAction] = "Installation Completed" And Not
(IsNull(Me.[dtCompleteDate])) Then
Me.Parent.[txtStatus] = "Closed"
End If
I have this code in the AfterUpdate event of the subform.
Does anyone have a suggestion? Should the event be initiated from the parent
form?
 
A subform does not have an AfterUpdate event. It would have to be a
field on your subform. Instead of the Me.Parent, try
Forms!MainFormName!txtStatus = "Closed"

Hope that helps!
 
Subforms (they are Forms, after all) do have Form_AfterUpdate Event, Jeff.

--
HTH
Van T. Dinh
MVP (Access)



Jeff L said:
A subform does not have an AfterUpdate event. It would have to be a
field on your subform. Instead of the Me.Parent, try
Forms!MainFormName!txtStatus = "Closed"

Hope that helps!


Susan said:
I'm attempting to change the status of a record on the main form to
"Closed"
based on two values entered on a continuous subform. Here's the code,
which
is generating a "recordset not updateable" error.

If Me.[cboDPAction] = "Installation Completed" And Not
(IsNull(Me.[dtCompleteDate])) Then
Me.Parent.[txtStatus] = "Closed"
End If
I have this code in the AfterUpdate event of the subform.
Does anyone have a suggestion? Should the event be initiated from the
parent
form?
 
Check that the RecordSource of the parent Form is updatable ...

If it is, check the "Recordset Type" Property (should not be "Snapshot") and
the AllowEdits Property.
 
Yes, it does have an AfterUpdate. I tried the suggested syntax and it's still
not working.

(PS: The source of the problem "recordset not updateable" is another issue
that I'm working on.)
--
susan


Van T. Dinh said:
Subforms (they are Forms, after all) do have Form_AfterUpdate Event, Jeff.

--
HTH
Van T. Dinh
MVP (Access)



Jeff L said:
A subform does not have an AfterUpdate event. It would have to be a
field on your subform. Instead of the Me.Parent, try
Forms!MainFormName!txtStatus = "Closed"

Hope that helps!


Susan said:
I'm attempting to change the status of a record on the main form to
"Closed"
based on two values entered on a continuous subform. Here's the code,
which
is generating a "recordset not updateable" error.

If Me.[cboDPAction] = "Installation Completed" And Not
(IsNull(Me.[dtCompleteDate])) Then
Me.Parent.[txtStatus] = "Closed"
End If
I have this code in the AfterUpdate event of the subform.
Does anyone have a suggestion? Should the event be initiated from the
parent
form?
 
If the Recordset is not updatable, you cannot change the value of bound
Controls when the Form is bound to a non-updatable Recordset. Thus, if you
fix up the Recordset, I think your code will work ...
 
Thanks Van. I fixed the problem with the recordset and it worked just fine.
--
susan


Van T. Dinh said:
Check that the RecordSource of the parent Form is updatable ...

If it is, check the "Recordset Type" Property (should not be "Snapshot") and
the AllowEdits Property.

--
HTH
Van T. Dinh
MVP (Access)



Susan L said:
I'm attempting to change the status of a record on the main form to
"Closed"
based on two values entered on a continuous subform. Here's the code,
which
is generating a "recordset not updateable" error.

If Me.[cboDPAction] = "Installation Completed" And Not
(IsNull(Me.[dtCompleteDate])) Then
Me.Parent.[txtStatus] = "Closed"
End If
I have this code in the AfterUpdate event of the subform.
Does anyone have a suggestion? Should the event be initiated from the
parent
form?
 
What kind of problem with a recordset would cause this behavior? I have a
database that worked just fine, then I had some corrupt records, did a
compact and repair, deleted the corrupt records, then pasted the records back
in from a backup, and now I get the recordset is not updateable error message
when I open the form. I tried exporting the form from a version of the
database that worked, and I still get the error message.


Susan L said:
Thanks Van. I fixed the problem with the recordset and it worked just fine.
--
susan


Van T. Dinh said:
Check that the RecordSource of the parent Form is updatable ...

If it is, check the "Recordset Type" Property (should not be "Snapshot") and
the AllowEdits Property.

--
HTH
Van T. Dinh
MVP (Access)



Susan L said:
I'm attempting to change the status of a record on the main form to
"Closed"
based on two values entered on a continuous subform. Here's the code,
which
is generating a "recordset not updateable" error.

If Me.[cboDPAction] = "Installation Completed" And Not
(IsNull(Me.[dtCompleteDate])) Then
Me.Parent.[txtStatus] = "Closed"
End If
I have this code in the AfterUpdate event of the subform.
Does anyone have a suggestion? Should the event be initiated from the
parent
form?
 
Back
Top