hello, how do i make a toggle button that when depressed, allows one to enter data. When not depressed, locks the fields and doesn't allow data to be entered?
What I would do is just change the caption of the button and then key my code off of what the caption says. For example:
Private Sub YourButton_Click()
If YourButton.Caption = "Lock Record" Then
YourText1.Locked = True
YourCombo1.Locked = True
etc, or loop through the controls
YourButton.Caption = "Unlock Record"
Else
YourText1.Locked = False
etc. as above
YourButton.Caption = "Lock Record"
End If
End Sub
Of course, you can also throw in a check of the user trying to unlock the record to see if the user has the appropriate security level for that action.
Sorry, this didn't work right. i received a bunch of errors ect. is there a way to either lock or unlock all the controls rather than loop through all the controlls?
If you want to lock/unlock everything then you can use Me.AllowEdits = False to lock and Me.AllowEdits = True. This is simpler, but you will need to make sure that the property is set where you want it when you move to a new record. Of course, you would need to do the same with the caption on the button.
How do i set these options and specify which way the toggle is defaulted to? is there a way to have the caption of the toggle button change when it is pressed? i'm not good with visual basic so any extra help would be greatly appreciated. thanks.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.