command buttons

lrAsIgo

New member
Local time
Today, 13:59
Joined
Jun 5, 2002
Messages
9
How would one create a command button to turn on and turn off the ability to allow the user to edit the data in the form?

I have one main form which was built using the form wizard. In this form I have other subforms which are linked to the main form.

I would like to be able to edit the data but not by default. I would like the user to cllick an "edit data/record" button. This would ensure that he/she is aware that the form is in edit mode once the button has been clicked.

Thanks for the help!
 
Add a button called cmdEdit. Change its caption to read "Locked Mode". Set the forms AllowEdits property to false.

Add this code to the click event of cmdEdit...

If cmdEdit.Caption = "Locked Mode" Then
AllowEdits = True
cmdEdit.Caption = "Edit Mode"
Else
AllowEdits = False
cmdEdit.Caption = "Locked Mode"
End If

Good luck!
 
This works for the main form but I have a tab control on the main form which contains a subform that is linked to the main form. When the form opens in locked mode the subform is not visible?

The subform does appear when navigating through the main forms records and a corresponging subform record exist in the subform.

The subform has a combo box which I use to select and to assign data records to a record in the main form. The subform also has a subquery contained in it which reflects the various selections and assignments for a particular record in the main form.

If a record as never been assigned the subform is not visible for some reason, when the allow edits is set to false.
 

Users who are viewing this thread

Back
Top Bottom