D
Dave Hoder
I'm using this code to go to a datasheet view in my form. I shouldn't be able
to edit anything in datasheet view (edits are allowed in form view) but all
my combo boxes still allow edits as well as some text fields while others
don't. If I briefly switch to Design View & back all seems well & no edits
are possible. Any ideas on how to make the properties stick?
Private Sub cmdDatasheet_Click()
On Error GoTo Err_cmdDatasheet_Click
Dim Response As Integer
If Me.Dirty = True Then 'If anything has changed prompt to save
Response = MsgBox("Would you like to save your changes?", vbYesNo,
"Save Changes?")
If Response = vbYes Then
cmdSave_Click
Else: DoCmd.RunCommand (acCmdUndo)
End If
End If
Me.ViewsAllowed = 2 'Allow Datasheet view
Me.AllowEdits = False 'Don't allow changes in Datasheet view
Me.AllowAdditions = False
Me.AllowDeletions = False
DoCmd.RunCommand (acCmdDatasheetView) 'Switch to datasheet view
DoCmd.Maximize
Exit_cmdDatasheet_Click:
Exit Sub
Err_cmdDatasheet_Click:
MsgBox Err.Description
Resume Exit_cmdDatasheet_Click
End Sub
to edit anything in datasheet view (edits are allowed in form view) but all
my combo boxes still allow edits as well as some text fields while others
don't. If I briefly switch to Design View & back all seems well & no edits
are possible. Any ideas on how to make the properties stick?
Private Sub cmdDatasheet_Click()
On Error GoTo Err_cmdDatasheet_Click
Dim Response As Integer
If Me.Dirty = True Then 'If anything has changed prompt to save
Response = MsgBox("Would you like to save your changes?", vbYesNo,
"Save Changes?")
If Response = vbYes Then
cmdSave_Click
Else: DoCmd.RunCommand (acCmdUndo)
End If
End If
Me.ViewsAllowed = 2 'Allow Datasheet view
Me.AllowEdits = False 'Don't allow changes in Datasheet view
Me.AllowAdditions = False
Me.AllowDeletions = False
DoCmd.RunCommand (acCmdDatasheetView) 'Switch to datasheet view
DoCmd.Maximize
Exit_cmdDatasheet_Click:
Exit Sub
Err_cmdDatasheet_Click:
MsgBox Err.Description
Resume Exit_cmdDatasheet_Click
End Sub