Results 1 to 10 of 10
  1. #1
    Join Date
    Dec 2007
    Posts
    17

    Unanswered: HOW TO: Button on a form to open a report?

    How do I make a button on a form to open a specific report, run a specific querey?

    I copied a button from the Northwind example and edited the onClick property, but it didnt work!

    Code:
    =OpenForms("Reservist Profile Currently On Orders")

  2. #2
    Join Date
    Jun 2007
    Posts
    33
    onClick event:

    DoCmd.OpenReport "Report Name"

  3. #3
    Join Date
    Dec 2007
    Posts
    17
    I get:

    Access can not find the macro 'DoCmd'.

  4. #4
    Join Date
    Jun 2007
    Posts
    33
    well...
    select the 3 dots "..." and then insert the code

  5. #5
    Join Date
    Dec 2007
    Posts
    5

    Post

    Quote Originally Posted by Jasen Hicks
    How do I make a button on a form to open a specific report, run a specific querey?

    I copied a button from the Northwind example and edited the onClick property, but it didnt work!

    Code:
    =OpenForms("Reservist Profile Currently On Orders")
    Of course it didnt. Have you considered using a basic Macro?

    Hit F11
    Objects>Macros>New Macro> Under Action within the drop down>OpenReport> Report Name: Find the name of the report you have made.> View: Print Preview

    Save the Macro as "Your Databases Name>Macro>Open Report>Report Name" (I suggest you follow this format as it makes things less confusing in the end when your list of Macros grow.)

    1. Go back to your form.
    3. On the Toolbar at the top hit View>Design View
    2. Right click on your button.
    3. Select properties.
    4. Click the event tab.
    5. Look for "On click.................." Click the field to the right.
    6. Within the drop down you will see the name of your Macro that you made.
    7. Click the Macro name.
    8. Close the Properties box.
    9. Go back to View>Form View
    10. Click your new button and your report should show up in Print Preview.

  6. #6
    Join Date
    Dec 2007
    Posts
    17
    Wow, that was perfect. Thanks! It worked great. Who ever said Marines were only good for getting shot?!

    Seriously though, thanks a lot. Your help saved the rest of my sanity.

  7. #7
    Join Date
    Nov 2003
    Posts
    1,487
    Who ever said Marines were only good for getting shot?!
    hmmm...good question. Wasn't it President Richard M. Nixon?

    .
    Environment:
    Self Taught In ALL Environments.....And It Shows!


  8. #8
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004

    Talking

    Quote Originally Posted by Jasen Hicks
    How do I make a button on a form to open a specific report, run a specific querey?

    I copied a button from the Northwind example and edited the onClick property, but it didnt work!

    Code:
    =OpenForms("Reservist Profile Currently On Orders")
    And here is yet another way to do the task:

    Code:
    Private Sub OrderStatus_Click()
    ' Opens the Order Status quick view form.
    
        DoCmd.OpenForm frmOrderStatus, acNormal, , , acFormEdit
        
    End Sub
    That simply opens a form, without any specific criteria.

    Have a nice one,
    BUD

  9. #9
    Join Date
    Dec 2007
    Posts
    17
    Thanks for the responses, i found out (accidently) that I can click the wizard button, then the button button and create a button that does this just as easily!

    Access is ok at best i have found, id still rather a php/mysql solution though. Too bad the navy wont let me have a server that can do it!

  10. #10
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    You won't be able to do half the things with php/mysql that you can do with MSAccess (and there's maybe a "few" (very few) things that you can do with php/mysql that you can't do with MSAccess)!

    Not that I'm fanatically pro-MSAccess but I do like to get things done quickly and easily.
    Last edited by pkstormy; 12-07-07 at 17:44.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •