Results 1 to 4 of 4
  1. #1
    Kirsti is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2012
    Location
    New Zealand
    Posts
    172

    VBA for on-click procedure to open form in DataSheet view

    Hi,

    I have a form with a command button on it to open another form. The form is set to DataSheet view, however when I open it via the command button, it opens in Form view. The VBA for the on-click event procedure is below.

    Private Sub cmdAvailableNow_Click()
    On Error GoTo Err_cmdAvailableNow_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "frmAvailableNow"
    DoCmd.OpenForm stDocName, , , stLinkCriteria


    Exit_cmdAvailableNow_Click:
    Exit Sub
    Err_cmdAvailableNow_Click:
    MsgBox Err.Description
    Resume Exit_cmdAvailableNow_Click

    End Sub

    I'm not at all experienced with writing VBA, but figure there must be something in here that can be changed to get the form to open in DataSheet view?

    Any help much appreciated.

    Thanks,
    Kirsti

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Look at this link for the syntax for your Docmd.OpenForm line

    http://msdn.microsoft.com/en-us/libr...ffice.10).aspx

    Alan

  3. #3
    Kirsti is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2012
    Location
    New Zealand
    Posts
    172
    Hi, thanks. I had a look at the link you pasted, and I understand that I need to include AcFormDS somewhere in the Docmd.OpenForm syntax, but have had a play and can't get it working properly, can you please help with the exact syntax?

    Thanks,
    Kirsti

  4. #4
    Kirsti is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2012
    Location
    New Zealand
    Posts
    172
    Figured it out.

    Thank you

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

Similar Threads

  1. Datasheet view of Split Form in a Tab??
    By tylerg11 in forum Forms
    Replies: 3
    Last Post: 12-19-2011, 04:37 PM
  2. BeforeUpdate in a Form in Datasheet view
    By fitshase in forum Forms
    Replies: 7
    Last Post: 07-29-2011, 08:53 AM
  3. Form opens table in datasheet view
    By franklbl in forum Forms
    Replies: 9
    Last Post: 03-23-2011, 09:43 PM
  4. Replies: 6
    Last Post: 04-24-2010, 11:12 AM
  5. Form - Datasheet View
    By kalove in forum Forms
    Replies: 0
    Last Post: 06-20-2007, 11:29 AM

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