Is there any shortcut key to switch over to Datasheet View from Form View and vice versa.
Is there any shortcut key to switch over to Datasheet View from Form View and vice versa.
In design mode, set the forms "Allow Form View" property and the "Allow Datasheet View" property to yes.
You can then change views by making the appropriate selection on the ribbon.
If this helped, please click the star at the bottom left of this posting and add to my reputation. Many thanks.
Bob Fitzpatrick
Maybe this??
Toggle forward between views when in a table, query, form, or report : Ctrl+Right Arrow or Ctrl+Comma (,)
Note: If additional views are available, successive keystrokes move the focus to the next available view.
See Keyboard shortcuts for Access
https://support.office.com/en-gb/art...#bkmk_workobjs
Or you can do it in code. Since you can't use Command Buttons in Datasheet View, you need to use the DoubleClick event of a Textbox, like this:
Remember to set Allow Form View and Allow Datasheet View Properties to Yes
Code:Private Sub AnyGivenControl_DblClick(Cancel As Integer) If Me.CurrentView = 1 Then DoCmd.RunCommand acCmdDatasheetView Else DoCmd.RunCommand acCmdFormView End If End Sub
Linq ;0)>
Or you can do it in code. Since you can't use Command Buttons in Datasheet View, you need to use the DoubleClick event of a Textbox, like this:
Remember to set Allow Form View and Allow Datasheet View Properties to Yes
Code:Private Sub AnyGivenControl_DblClick(Cancel As Integer) If Me.CurrentView = 1 Then DoCmd.RunCommand acCmdDatasheetView Else DoCmd.RunCommand acCmdFormView End If End Sub
Linq ;0)>
It is working fine! Thanks!! God Bless You!!!
Please give a brief explaination of "Cancel As Integer" & " Me.CurrentView = 1"
Cancel As Integer - some events can be cancelled. Usually, in a very early part of the code, you perform a test (dog = cat), and if it fails (is false) you then write Cancel = True and the event ceases. Thus whatever action the event was for (such as double click or open a form) does not occur. While the syntax seems like a number is required, True / False are constants that have numerical values (-1, 0).
Me.CurrentView = 1 - similar to the above re: constants, some values for a form property (such as the view) have only numerical possibilities. In this case, 1 is for Form View Sometimes, the acceptable value can be a number or a vba constant aka "system" and "intrinsic" constants, which resemble words.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
Thank You! God Bless You!Cancel As Integer - some events can be cancelled. Usually, in a very early part of the code, you perform a test (dog = cat), and if it fails (is false) you then write Cancel = True and the event ceases. Thus whatever action the event was for (such as double click or open a form) does not occur. While the syntax seems like a number is required, True / False are constants that have numerical values (-1, 0).
Me.CurrentView = 1 - similar to the above re: constants, some values for a form property (such as the view) have only numerical possibilities. In this case, 1 is for Form View Sometimes, the acceptable value can be a number or a vba constant aka "system" and "intrinsic" constants, which resemble words.