Results 1 to 4 of 4

Thread: How to generate report based on combo box selection

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Arrow How to generate report based on combo box selection

    Hi guys . I created a form that has 3 combo boxes. Their name are Project
    Number, year and weekno . It has also a button that on click action supposed
    to generate a report baced on my combo box criteria and then loads that report
    for me. could any expert show me an example on how to do this. I have difficulty
    finding an example in google since i did not exactly what is called this method
    of generating report in access 2000.Thanks

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: How to generate report based on combo box selection

    One way:
    Create a query to get what you want based on those values, e.g.,
    VB Code:
    1. SELECT * FROM tblFoo WHERE fldProj = Forms!frmFoo![Project Number] AND fldNum = Forms!frmFoo![year] AND fldWkNum = Forms!frmFoo![weekno]
    and set the report's RecordSource to the query.
    You could also do queryDef's & parameters in code.
    Tengo mas preguntas que contestas

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Arrow Re: How to generate report based on combo box selection

    Quote Originally Posted by salvelinus
    One way:
    Create a query to get what you want based on those values, e.g.,
    VB Code:
    1. SELECT * FROM tblFoo WHERE fldProj = Forms!frmFoo![Project Number] AND fldNum = Forms!frmFoo![year] AND fldWkNum = Forms!frmFoo![weekno]
    and set the report's RecordSource to the query.
    You could also do queryDef's & parameters in code.

    Thank u for u reply. Is this for access 2000 ? where should i place your code?
    could u explain allitle more on what to put on click event of the button on the form.Thanks

    http://i5.photobucket.com/albums/y18...rojectdata.jpg ( report )

    http://i5.photobucket.com/albums/y18...etionship4.jpg ( db tables)

  4. #4
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: How to generate report based on combo box selection

    Yes, Access 2000, and probably any version of Access (97 on, anyway).
    Easiest way -
    Create & save the query. It won't run by itself, but that's ok. Create the report and set the report's RecordSource property to the query.
    In the form, in the Click event of a button put DoCmd.OpenReport "rptFoo" (or whatever your report's name is).
    If you want a report in Word or Excel format (looking at your upload), that's a different story. But the above will work for an Access report.
    Tengo mas preguntas que contestas

Posting Permissions

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



Click Here to Expand Forum to Full Width