Close and save records

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

Guest

I have a form (in single view) which is locked. If people have information
to be added to the form I have a command button which when clicked allows it
to be edited and information added to the record. I have a used the save
button to save the information to the record. Unfortunatelky this still
leaves the form open for edits. I have tried the save on close but this
closes the whole form. Is there a way of using a code/command to save the
information added to the record as well as putting the form back to its
original state of being locked?
 
emc said:
I have a form (in single view) which is locked. If people have information
to be added to the form I have a command button which when clicked allows
it
to be edited and information added to the record. I have a used the save
button to save the information to the record. Unfortunatelky this still
leaves the form open for edits. I have tried the save on close but this
closes the whole form. Is there a way of using a code/command to save the
information added to the record as well as putting the form back to its
original state of being locked?

Care to share your existing code with us?

Keith.
www.keithwilby.com
 
I am assuming the Click event of the Save button is where you save the
record. Just add code to it to put the controls back to the state you want
them in.
 
Thanks, my Edit Code is:

Private Sub Command53_Click()
Me.AllowEdits = True
End Sub

Close Code is:

Private Sub Command59_Click()
DoCmd.Close , , acSaveYes
End Sub
 
Yes, you are correct. However, my knowledge of code is basic to say the
least and am unsure of which command to use.
 
There is no specific code to save a record for a bound form. The easiest way
to do it, is Me.Dirty = False
That will update the current record.

Now, when you save the form is locked, are you saying that all the controls
are locked, or that the form properties are set so that you can only add new
records?
 
All the controls are locked. I have an "Add New" command button if a new
record is to be added. The "Edit" command button is used to allow
amendments/changes. However when the "Edit" button is used, all the records
are then ulocked, not just the one which you are focused on. I had thought
that perhaps I could add code and/or a command button to save the changes
made to the record which was edited whilst returning the form back to being
locked again.
 
That should not be a problem. Put the code to lock the controls in the After
update event of the form. That way, any time the current record is saved,
regardless of how it is accomplished, the form will return to its locked
state.
 
Back
Top