R
Rizza
I am not trying to have bad posting netiquette by reposting. It appears my
other two posts are dead. Here is my problem with more detail this time.
End goal: I am running a process which runs many queries, sub routines and
functions. I have many process variables used in the queries and such. I
have decided to store the values in the default value property of the text
boxes on a form. The form will be pass protected. Then I wish to make an
MDE to prevent any changes without a password. I have written the code to
update the default value of a textbox from a button. It seems I should be
able
to call code to change these values which it does. However, if I close the
form it does not retain the updated default values unless I make the changes
in design. My requirement is for the values to be modifiable from the
form and secure.
Running Access 2003
Code:
''' This code does not work
Private Sub btnCommit_Click()
Dim demRet As Integer
demRet = Me.txtDemRet
Me.txtDemRet.DefaultValue = demRet
'DoCmd.Save
DoCmd.Save acForm, "Controls"
'DoCmd.Close acForm, Me.Name, acSaveYes 'From Klatuu
End Sub
''' This code works
Private Sub btnCommit_Click()
Dim demRet As Integer
demRet = Me.txtDemRet
DoCmd.OpenForm "Controls", acDesign, , , acFormEdit
Forms!Controls!txtDemRet.DefaultValue = demRet
DoCmd.OpenForm "Controls", acNormal
DoCmd.Save
End Sub
other two posts are dead. Here is my problem with more detail this time.
End goal: I am running a process which runs many queries, sub routines and
functions. I have many process variables used in the queries and such. I
have decided to store the values in the default value property of the text
boxes on a form. The form will be pass protected. Then I wish to make an
MDE to prevent any changes without a password. I have written the code to
update the default value of a textbox from a button. It seems I should be
able
to call code to change these values which it does. However, if I close the
form it does not retain the updated default values unless I make the changes
in design. My requirement is for the values to be modifiable from the
form and secure.
Running Access 2003
Code:
''' This code does not work
Private Sub btnCommit_Click()
Dim demRet As Integer
demRet = Me.txtDemRet
Me.txtDemRet.DefaultValue = demRet
'DoCmd.Save
DoCmd.Save acForm, "Controls"
'DoCmd.Close acForm, Me.Name, acSaveYes 'From Klatuu
End Sub
''' This code works
Private Sub btnCommit_Click()
Dim demRet As Integer
demRet = Me.txtDemRet
DoCmd.OpenForm "Controls", acDesign, , , acFormEdit
Forms!Controls!txtDemRet.DefaultValue = demRet
DoCmd.OpenForm "Controls", acNormal
DoCmd.Save
End Sub