Me.subTestForm.SetFocus
DoCmd.RunCommand acCmdSubformDatasheet
If Me.cmdDatasheet.Caption = "Datasheet View" Then
Me.cmdDatasheet.Caption = "Form View"
Else
Me.cmdDatasheet.Caption = "Datasheet View"
End If
Exit Sub
ErrCmdDatasheet:
Select Case Err
Case 2046
'Datasheet view not available
MsgBox "This command not available at this time"
Exit Sub
Case Else
MsgBox Err.Number & vbCrLf & Err.Description
Exit Sub
End Select