skelley
08-18-2000, 09:41 AM
Is there a way to have one (1) form open in either read only mode or edit mode from an Access Switchboard?
For the moment I have two (2)forms. One with the properties set to read only and the other not.
Every time I make a change to one, I have to recreate the other by saving it as "formname - read only" and then changing the properties to "No Edits".
D B Lawson
08-18-2000, 11:59 AM
The switchboard doesn't give you to option to open the form in read only mode so you could create a macro to open the form in read only mode and then assign the switchboard function to the macro. You could then assign another switchboard function to open the same form in edit mode.
[This message has been edited by D B Lawson (edited 08-18-2000).]
jaxbuilder
08-21-2000, 05:35 AM
I started down this path of having a read-only form and an edit form, but it got annoying to have to keep the two forms in sync. I now use a pair of global procedures to change the form from read-only to update (by changing the LOCKED and ENABLED properties of all controls on the form). I also change the background color of the form to indicate to the user which mode they are in.
UnlockControls(Me)
Me.Detail.BackColor = RGB(163, 224, 163) 'Set form background to green
Public Function UnLockControls(frm As Form)
'This procedure loops through all controls on a form and sets the Locked property to false
' and the Enabled property to true. It acts only on text boxes, list boxes,
' check boxes & combo boxes.
Dim ctl As Control
For Each ctl In frm.Controls
If TypeOf ctl Is TextBox Or TypeOf ctl Is ComboBox Or TypeOf ctl Is ListBox _
Or TypeOf ctl Is CheckBox Then
ctl.Locked = False
ctl.Enabled = True
End If
Next
End Function
Public Function LockControls(frm As Form)
'This procedure loops through all controls on a form and sets the Locked property to true
' and the Enabled property to false. It acts only on text boxes, list boxes,
' check boxes & combo boxes.
Dim ctl As Control
For Each ctl In frm.Controls
If TypeOf ctl Is TextBox Or TypeOf ctl Is ComboBox Or TypeOf ctl Is ListBox _
Or TypeOf ctl Is CheckBox Then
ctl.Locked = True
ctl.Enabled = True
End If
Next
End Function
[This message has been edited by jaxbuilder (edited 08-21-2000).]