Update and Save a Subform

Learn2010

Registered User.
Local time
Today, 10:07
Joined
Sep 15, 2010
Messages
415
I have a form (frmRegistration) and a subform (frmRegistrationSub). On the subform is a field that receives a letter when a button is clicked. This field gets counted. So, after clicking the button, I need to update the count. I do this with the Docmd.RunSQL code.

START OF CODE
Registered.SetFocus
Registered = "R"
DoCmd.RunSQL "UPDATE tblAttendeesRegisteredHold SET tblAttendeesRegisteredHold.AttendeeCt = [AttendeeCt]+1;"
DoCmd.Save acForm, "frmRegistrationSub"
Forms!frmRegistration.frmRegistrationSub.Requery
END OF CODE

I tried to save the form and the subform but it errors out on both. So, how do you save the form(s) after the update takes place? Do you need more info?

Thank you.
 
That wouldn't be a valid reference to the subform, but you don't need to save it if you're trying to save the data. A bound form will try to save its data anyway. DoCmd.Save is saving the form object itself, not the data within.
 
How do I save the data in that field? The field is:

Forms!frmRegistration.frmRegistrationSub.Form.Registered
 
Like I said, if the form is bound to the table and the textbox is bound to a field in that table, it will save automatically.
 

Users who are viewing this thread

Back
Top Bottom