Results 1 to 7 of 7
  1. #1
    Kundan is offline Competent Performer
    Windows XP Access 2013 32bit
    Join Date
    Mar 2018
    Posts
    155

    Regarding Forms


    Is there any shortcut key to switch over to Datasheet View from Form View and vice versa.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    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

  3. #3
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    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

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    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)>

  5. #5
    Kundan is offline Competent Performer
    Windows XP Access 2013 32bit
    Join Date
    Mar 2018
    Posts
    155
    Quote Originally Posted by Missinglinq View Post
    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​"

  6. #6
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    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.

  7. #7
    Kundan is offline Competent Performer
    Windows XP Access 2013 32bit
    Join Date
    Mar 2018
    Posts
    155
    Quote Originally Posted by Micron View Post
    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.
    Thank You! God Bless You!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 04-05-2016, 08:29 AM
  2. Replies: 3
    Last Post: 03-23-2016, 12:45 PM
  3. Replies: 2
    Last Post: 11-05-2014, 09:16 AM
  4. Replies: 1
    Last Post: 01-04-2011, 05:04 AM
  5. Replies: 4
    Last Post: 04-01-2009, 08:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums