Add and Edit

  • Thread starter Thread starter KRISH
  • Start date Start date
K

KRISH

Hi everybody,

I am placing edit button so that unless user presses it he
cannot be able to edit records in the form. my problem is
if he presses it my form all records in are open for
editing. how to change edit modes when user changes to new
record. My form contains subform also. so the edit mode
should be same for both main and subform with the same
button on main form. kindly help. thanks for any help.

krish
 
KRISH said:
Hi everybody,

I am placing edit button so that unless user presses it he
cannot be able to edit records in the form. my problem is
if he presses it my form all records in are open for
editing. how to change edit modes when user changes to new
record. My form contains subform also. so the edit mode
should be same for both main and subform with the same
button on main form. kindly help. thanks for any help.

krish

You're going to need code both for your command button and for the
form's Current event. In its simplest form, it might look like this:

Private Sub Form_Current()
Me.AllowEdits = False
Me!sfMySubformControl.Form.AllowEdits = False
End Sub

Private Sub cmdEdit_Click()
Me.AllowEdits = True
Me!sfMySubformControl.Form.AllowEdits = True
End Sub

(where "sfMySubformControl" is the name of the subform control on the
main form, which may or may not be the same as the name of the fom
object the subform control displayes)

Do you want to allow the user to add new records on this form without
having to click the button? Do you want the user to be able to delete
records without having to click the button? If you want to control
those operations with the button also, you'll need add additional lines
to the event procedures to set the AllowAdditions and AllowDeletions
properties.
 
Back
Top