Results 1 to 8 of 8
  1. #1
    JayX is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    62

    Button Command

    Is there a way to click a button and it opens a query in Datasheet view?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I would never let a user into a query, but how about:

    DoCmd.OpenQuery

    with the appropriate arguments.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    JayX is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    62
    what do you mean with the appropriate arguments?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Look in VBA help for the arguments available for OpenQuery, and use the ones appropriate to your needs.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    JayX is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    62
    my code looks like this:

    Private Sub Command7_Click()
    DoCmd.OpenQuery
    End Sub

    I keep getting an error saying Compile Error: Argument not optional?

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Did you look in Help at the arguments?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    JayX is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    62
    Yes, I found what I was looking for...thank you

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Button Command
    By JayX in forum Access
    Replies: 2
    Last Post: 12-15-2011, 12:33 PM
  2. Command Button
    By tia in forum Access
    Replies: 1
    Last Post: 11-20-2011, 11:47 AM
  3. Replies: 1
    Last Post: 07-27-2010, 02:27 PM
  4. Command Button
    By nashr1928 in forum Forms
    Replies: 2
    Last Post: 07-05-2010, 08:02 PM
  5. Command Button
    By lannoe in forum Forms
    Replies: 1
    Last Post: 07-01-2010, 01:48 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