5 Replies Latest reply on Aug 18, 2009 1:07 PM by mscogna

    Want user to select month and year in screen and find records accordingly

    mscogna

      Title

      Want user to select month and year in screen and find records accordingly

      Post

      Hello,

       

      I am using Filemaker Pro 7, and have been away from it for a while, so "rusty" is an understatement.

       

      I have an input screen with two fields, month and year (both drop down lists) and I would like the user

      to select the month and year and then find all matching records.

       

      Any help would be greatly appreciated.

       

      Thank You.

       

      Mike

        • 1. Re: Want user to select month and year in screen and find records accordingly
          philmodjunk
            

          If your search fields are global fields, you can create a script that uses the info in the two fields to perform a find.

           

          However, there may be a way to avoid using the two search fields completely.

           

          This works inFMP 10, See if it works in FMP 7:

           

          Select a layout that shows the date field.

          Enter find mode

          Enter month/year in the date field (5/2009 means may, 2009)

          Perform the find.

          • 2. Re: Want user to select month and year in screen and find records accordingly
            mscogna
              

            Hi,

            Thanks for responding.

             

            FM7 help says "You can't use a global field to find records."

             

            I have fields in the database which are COMMRPTMonth and COMMRptYear.

             

            I am trying to do a report based on a month and year   So the user will pick  03  and 2009   and then I want to be able to perform

            a find with those choices and create report with the records found. 

             

            Sorry if I am being dumb but I am trying to make it as easy as possible for this user.

            • 3. Re: Want user to select month and year in screen and find records accordingly
              philmodjunk
                

              I've been using global fields to set up finds since global fields were added as a new feature to filemaker way back when.

               

              The help file is telling you that you can't enter find mode and enter search criteria in a global field. That won't work and it doesn't make any sense to do this anyway. You CAN use global fields to build search criteria that is entered into another nonglobal field, (such as your date field) to perform a find.

               

              Define your fields as global.

               

              Here's simple script/calculation field approach that'll work for you.

               

              Define the two drop down fields as global fields. I'm assuming the month field is a text field where the user will selet a month name (January, February...) and the year name is a year field where the user will enter/select a 4 digit year.

              Define a calculation field, MonthYear, set it to return text and enter the following expression:

              MonthName(Yourdatefield) & ", " & Year(yourdatefield)

               

              Now write your script:

              Enter find mode[]

              Set field [MonthYear, MonthDropDownField & " " & YearDropDownField]

              Set Error capture [on]

              Perform Find[]

              Set Errror capture [off]

              Go to layout [Specify a layout where you can see the fields you've just found]

               

              You'll need to insert your  fields in place of "yourdatefield" and the above references to "dropdown" fields.

               

              Attach a button next to your search fields and set it to perform the above script.

              • 4. Re: Want user to select month and year in screen and find records accordingly
                comment_1
                  

                mscogna wrote:
                I have fields in the database which are COMMRPTMonth and COMMRptYear.

                 

                I am trying to do a report based on a month and year   So the user will pick  03  and 2009   and then I want to be able to perform

                a find with those choices and create report with the records found.


                Assuming user has entered "03" into a global gMonth field, and "2009" into a global COMMRptYear field:

                 

                Enter Find Mode []

                Set Field [ COMMRPTMonth ; gMonth ]

                Set Field [ COMMRptYear ; gYear ]

                Perform Find[]

                 

                No calculation fields are necessary for this.

                • 5. Re: Want user to select month and year in screen and find records accordingly
                  mscogna
                    

                  Thanks to both of you

                   

                  Both ways worked !!

                   

                  Much Appreciation !!!!!!