fredzeppelin
Technical User
Simple need: to fill-in a form-based new record with data from the previously added record.
The FAQ's lead to this:
then bind the function to .AfterUpdate event for the pertinent controls.
I can't get it to work.
If I set a breakpoint in the function, I can watch the controls' default values changing as desired in their property sheets. So, the function seems to be working fine.
I then close the form, saving the record. If I reopen the form to add or edit, the control default values are cleared.
What's happening to the default values?
I know that when I change a form design manually, I'm prompted to save the form design changes. Am I missing a save step in here somewhere? I've tried doing a
but I'm not sure if that's saving the form or the record.
Background:
This is a fairly complex form with tabs and relational subforms and lots of arithmetic code. To try to limit potential trouble, I disable the '* new record' function in the record navigator and handle adds as a home-rolled menu function, that opens the form(on record #1 of the pertinent recordset), verifies the add ("you sure?"), and then
The FAQ's lead to this:
Code:
Private Function SetDefault()
Dim ctl As Control
Set ctl = Screen.ActiveControl
ctl.DefaultValue = """" & ctl.Value & """"
End Function
then bind the function to .AfterUpdate event for the pertinent controls.
I can't get it to work.
If I set a breakpoint in the function, I can watch the controls' default values changing as desired in their property sheets. So, the function seems to be working fine.
I then close the form, saving the record. If I reopen the form to add or edit, the control default values are cleared.
What's happening to the default values?
I know that when I change a form design manually, I'm prompted to save the form design changes. Am I missing a save step in here somewhere? I've tried doing a
Code:
DoCmd.Save acForm, Me.Name
Background:
This is a fairly complex form with tabs and relational subforms and lots of arithmetic code. To try to limit potential trouble, I disable the '* new record' function in the record navigator and handle adds as a home-rolled menu function, that opens the form(on record #1 of the pertinent recordset), verifies the add ("you sure?"), and then
Code:
DoCmd.GoToRecord acActiveDataObject, , acNewRec