Results 1 to 11 of 11
  1. #1
    Join Date
    Mar 2004
    Posts
    361

    Unanswered: Create a report from a button?

    Is it possible to create a report from a button. I have added a button to a form that queries specific information. Can i place a button below that one to run that query into a report. I looked through the button wizard and I can't seem to find what I am looking for.

    Thanks for taking a look.

  2. #2
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557

    Yes and No

    As far as I know the answer to your question is Yes and then again No.

    Yes is...

    You can write a VBA function for that button to open a prexisting Report.

    No is...

    I dont know that a button can create a report off of a query. I am sure it is possible but I have to this point in my programming not done it myself.

    Hope this helps,
    Jarvis
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Can you post more detail regarding what you would like to do?

    Are you trying to create a report on the fly, or are you trying to pass a restricted datasource to an existing report?

  4. #4
    Join Date
    Feb 2004
    Location
    Wales
    Posts
    343
    the answer is YES!

    In the the forms design mode you sould see (if its active) the toolbox.

    Right hand side of that is the command button icon - click this and when the curser is moved over the form you will have a box outline. Left mouse click and the Button Wizard will place a button on the form.

    The command button wizard will appear and will allow you to select the Report Operations - the right hand window will be the operations to :-
    Mail Report - Preview Report - Print Report - Send Reporrt to File

    select either Preview or print report, a list of the available reports will appear and then click on the one you want to print or preview thereafter you can select a name for the button or an icon

    hope this helps

    gareth

  5. #5
    Join Date
    Mar 2004
    Posts
    361
    I am going to put the data from the query into the report. I want to query specific information from a table and present it in a report. If I can do this in one shoot, all the better.

  6. #6
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Originally posted by tjarvas
    I am going to put the data from the query into the report. I want to query specific information from a table and present it in a report. If I can do this in one shoot, all the better.
    Will the format of the report, or data ever change? I don't understand your response.

    Assuming you only need to filter the data in report, via controls on a form, then you may pass parameters to the recordsource of a report.

    Please explain, IN DETAIL, what you would like to accomplish.

  7. #7
    Join Date
    Mar 2004
    Posts
    361
    Let me see if I can explain my project in a different way. I am building a database that hold inventory data. On a form I am allowing the user to query information by searching a table with a unique number. A few text boxes populate on the form for validation reasons. At this point the user add new information to that acct number. At this point the user presses a button that writes the updated information to a table. From this table I want to query specific information and show it in a report form. The layout of the report will never change but the data that the query will get will change. The main question is can I have a report that shows specific information from a table without running a query. If I do have to run a query to filter the data, is there a way to "one click" something to create a report with that queried data. I hope that this helps. Thanks for the patience.

  8. #8
    Join Date
    Mar 2004
    Posts
    82
    I suspect Jarvas is asking a simple question.

    Reports are generally based on an underlying query. So, conceptualize your report, then construct the query. Finally, build the report (either using the wizard or in design mode) with the Fields in view and place them where you want. The control source for the report (in the property box) should point to the underlying query.

    When you then place a command button (as explained in a previous post) on the form, you can have it open this report.

    I hope that's what you wanted.

  9. #9
    Join Date
    Mar 2004
    Posts
    361
    I guess the simple question is how do I create a button that runs the report?

  10. #10
    Join Date
    Mar 2004
    Posts
    361
    Never mind I got it. Thanks so much for your time. I appreciate this very much.

  11. #11
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557

    Create a button...

    Okay first open the form in design view (duh right?)

    put the button on there. When the wizard pops up click cancel.

    Right click the button and open properties.
    Click the event tab.
    scroll down to the OnClick one and select Event Procedure and click the ... to the right.

    Now for the coding:

    Code:
    Private Sub yourbuttonname_OnClick()
    
    DoCmd.OpenReport "yourreportname", acViewPreview, , , acWindowNormal
    
    End Sub
    Hope that helps,
    J
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

Posting Permissions

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