Results 1 to 6 of 6
  1. #1
    Huddle is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Jun 2010
    Posts
    318

    Won't open in datasheet view from switchboard

    I can't get my form to default to the datasheet view from the switchboard so I was going to do an "on load" with the below code but it is not working. Can you let me know what I am missing?

    Private Sub Form_Load()
    Me.Visible = False
    stDocName = "Fm_Schedule_Quick_Glance"
    Me.Visible = False
    DoCmd.OpenForm stDocName, acFormDS, , , , acDialog
    DoCmd.Restore
    Me.Visible = True

    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,597
    If the form DefaultView property is set to Datasheet and the AllowDatasheet property is set to yes, then the form should open in Datasheet unless code overrides these settings.

    Want to provide db for analysis? Follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Huddle is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Jun 2010
    Posts
    318
    The defaultview is datasheet and the allowdatasheet is yes. The issue I feel is that it is being opened from a switchboard in edit mode and it is overriding the default. That is why I wanted to put in the code. I can not provide the database for analysis.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,597
    What do you mean by 'edit mode'? Why would this prevent DatasheetView?

    If you can't provide db, doubt can be helpful. Don't care about data, just structure.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Huddle is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Jun 2010
    Posts
    318
    If you open in the Quick Glance Form you get the datasheet view. If you open from the Switchboard you get an error due to the bad code. Database2.zip

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,597
    Crud! Just as I was afraid of. The switchboard was built with wizard and uses embedded macros. Macros is one reason I don't use wizards - I don't use macros, only VBA. And have never utilized a 'switchboard' - I build menu forms from scratch and use VBA for code.

    Load event VBA procedure behind the opening form triggers error message #2174 'You can't switch to a different view at this time.', which actually makes sense. Can't have code behind a form to open itself. I tried to programmatically set the DefaultView property but that is not possible.

    View this thread on the topic http://bytes.com/topic/access/answer...er-form-opened
    The reply by FishVal might resolve your issue.

    I think it's an inherent bug in macros. Unless specified otherwise in the macro, the OpenForm will override form defaults and open form in SingleView.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 8
    Last Post: 06-25-2014, 08:03 AM
  2. Replies: 5
    Last Post: 04-13-2012, 02:51 PM
  3. Replies: 3
    Last Post: 02-23-2012, 04:48 PM
  4. Default View from Switchboard
    By JRINC in forum Forms
    Replies: 3
    Last Post: 10-12-2011, 01:34 PM
  5. Datasheet view in tab only
    By cdzajp in forum Forms
    Replies: 1
    Last Post: 06-22-2011, 12:44 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