5 Replies Latest reply on Dec 19, 2008 12:45 PM by ninja

    Button and records

    trunkp

      Title

      Button and records

      Post

      How do I make a button go to a specific record in the database? The button will open the layout but it opens to the first record in the layout and I want it to open to a specific record in the layout, say record number 2100 out of a total of 2500 records. Thanks.

        • 1. Re: Button and records
          ninja
            

          Trunkp,

           

          If you make a two step script something like:

          Go to Layout (------)

          Go to Record/Request/Page

           

          Then you can specify the record that you want to go to (whether by fixed number, calculation, or whatever is appropriate)

           

          Then have your button run this script rather than having it go to a layout.

          +++++++++++++

          Differently, assuming the record you want to go to is related to the one you are looking at when you press the button, have the button function be "Go to Related Record" which then allows you to define the layout used to view the related record.

           

          Hope I guessed well at what you're trying to do.

          • 2. Re: Button and records
            trunkp
               Thanks for your quick reply. I am new to FMPro and I followed your advices and I do not know how to insert into the script a "fixed number". 
            • 3. Re: Button and records
              ninja
                

              If you go that route (ie. script containing "go to record/request/page"), on the script step for "go to Record/Request/Page" you'll see a "Specify" button to add details to the "go to" command.

               

              One of the choices in the drop down list is "by Calculation".

               

              When you select that item, a calculation box will appear.  The result of the calculation must be a number.  If you always want to go to the same record number every single time...just type in the number.  If the number would change based on some variable, you'll have to find a way to define by equation which number you want in order to cover the various situations you may have.

               

              If you want different records at different times...you may want to explore the help screens regarding related records.  Without knowing more about what you're after...its hard to tell.

               

              • 4. Re: Button and records
                trunkp
                  

                Thanks for your reply. I created a button and I followed your advice and choose:

                 

                1.Go to Layout(----)

                2. Go to records/request page

                The "specify box" came up and I choose calculations. In the calculations box I typed in 2129. That is the record I want to open when I click the button. I have 2625 total records. It opens in the layout I want but it always opens in record #1.  I am not sure what I am doing wrong.

                • 5. Re: Button and records
                  ninja
                    

                  Hey trunkp,

                  I just tried this on one of my live databases as a test.

                   

                  Script:

                  Go to Layout["layout name"(table name)]

                  Go to Record/Request/Page[no dialog;2129]

                   

                  I defined the button to run this particular script

                   

                  I pushed the button and it sent me to record #2129 in the specified layout.

                   

                  Did you have the "perform without dialog box" checked?  Even if you didn't, a box should have popped up to verify that you wanted record#2129.  Verify that you have the button defined to run the script and haven't left it on "Go to Layout", and verify that the script looks like what is above.  It works fine here.

                   

                  Best of luck!