I am using Access 2007 and trying to open a Form in Datasheet view via a command button. I have the following code to open it:
Code:
Private Sub cmdDefaultElects_Click()
DoCmd.OpenForm "frm-Default_Election_Amounts", acFormDS
End Sub
However, when I click the button, it opens in the default form view (single record at a time) instead of Datasheet view. If I open the Form directly from the Objects menu, it correctly opens in Datasheet view.
I have even gone into the Properties of the Form and changed the following:
Default View: Datasheet
Allow Form View: No
Allow DataSheet View: Yes
But it made no difference when trying to open it from my Command Button.
Any ideas why this is happening, and how I can get my Form to open in Datasheet View when opening from a Command Button?