How to make a form create a report?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • slenish
    Contributor
    • Feb 2010
    • 283

    How to make a form create a report?

    Im having trouble trying to get a report to pull based on selections you make from 3 combo boxes.

    What I have are 3 combo boxes city, state, and zip code. What im trying to do is make is so you can select either one, two, or all three combo boxes and then press a button that will create a report showing the city state and zip along with an id number that is on the back end. I have been trying to get a query to run everything once you press the button but keep getting blank records. In the criteria of the query for the city state and zip I have the expression

    Code:
    [Forms]![FIDLookUp]![cboCombo0]
    [Forms]![FIDLookUp]![cboCombo2]
    [Forms]![FIDLookUp]![cboCombo4]
    Im not sure what else i need to put in to make it pull the information plus im not sure if I need to tell the command button to do more when you click it.

    Also i only need the report to display in a preview mode I dont need to print the report at all.
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32645

    #2
    The easiest way to handle this is to formulate a filter string, in the format of a SQL WHERE clause, but without the word "WHERE", that includes only those elements that are selected.

    With this filter string you can open the report from your form, passing the filter string as the WhereCondition parameter.

    Comment

    • slenish
      Contributor
      • Feb 2010
      • 283

      #3
      Originally posted by NeoPa
      The easiest way to handle this is to formulate a filter string, in the format of a SQL WHERE clause, but without the word "WHERE", that includes only those elements that are selected.

      With this filter string you can open the report from your form, passing the filter string as the WhereCondition parameter.
      Hi NeoPa,

      Thanks for replying. Any chance you could show me an example of what you are talking about? I tried using Where in front of my expressions in the Query, and so far im having no luck and it keeps pulling up blank information. The only way things are working for me is if I dont have the report linked to the form and you press the run report button I have set up and a pop up box opens and asks you to type in the information then it works great. Other than that I cant get the form drop down boxes to work.

      thanks again

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32645

        #4
        Hopefully these links (Example Filtering on a Form & Cascading Combo/List Boxes) will do better than that. They go through the whole concept in some detail, including an example database to play with.

        Comment

        • slenish
          Contributor
          • Feb 2010
          • 283

          #5
          Hi NeoPa,

          Thanks for the links. There is a lot of information there really appreciate it.

          After looking over the links in more detail and then doing more research i think you might have misunderstood what im trying to do. Its my fault going back and looking at what i wrote.

          What im trying to do is create more of a search query based off of a form. So i have 3 combo boxes. What you can do is select a city, state and zip code. Then I have a button to run a query that will look at the table and then based on what city state and zip you typed in will find that record and return the city state zip along with an id number that matches it. I dont need to cascade the boxes or anything like that. I just need to have it you select a city name or state or zip and press query, and it will look through the table and find all the cities, states, and zip that match that criteria and create a list of all the cities states and zip codes based off of what you typed in or selected.

          Its seems like it should be real simple to do but for some reason its not.

          Hope that is a better explanation

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32645

            #6
            If you look at the first link again you should find that's pretty well what it's talking about. The details will be different of course, but the concept is exactly what you describe.

            It handles filtering on Text, Numeric and Date controls. It filters the main form it's on, but the same concept could equally easily be used for filtering a report or any other object based on a dataset.

            Comment

            Working...