8 Replies Latest reply on Dec 30, 2015 6:59 AM by quirkycrone

    Go to Next after Find?  Record missing (error 101)


      I have been working on a script. FM 13 Adv. Since I move from one layout (receipts) to another (expose prints) in order to update the prints record for purchase, after I find and update the print record I select the receipts layout, find the record that corresponds to the update, enter browse mode and TRY to move on to the next record to repeat the process of updating the subsequent records.

      The script bombs at this point and reports Error 101 (Missing record).


      What the dickens am I doing wrong?????  Script is attached as a pdf.

        • 1. Re: Go to Next after Find?  Record missing (error 101)

          A few things stand out:

          1.     The Go to Layout step to take you back to your opening "receipts" layout is disabled, so you will only be on that layout at that point in the script if you have encountered a 401 error.

          2.     The main Loop is not closed—unless that part of the script is not printed here.

          3.     You have no initial Find in the script, so how do you know what set of records you are working with?

          4.     You potentially perform Finds in this same "receipts" layout at two other points in the script, so if your Go to next record step is intended to move you through the receipts records you cannot be sure that will be happening as intended.


          That's enough for starters.

          • 2. Re: Go to Next after Find?  Record missing (error 101)

            You are not looking at page two of the PDF where the loop closes. There are

            two finds I made in the script.  The first is to locate the PRINTS record

            to update, the second is to relocate the record I was working on in



            For Starters, I start at the first record of Receipts. When I GO TO NEXT  I

            should already be in the Receipts layout if I found the record (error

            code=0) or if the record was not found (error code=401).


            Soooo, I am still sorting it out..

            • 3. Re: Go to Next after Find?  Record missing (error 101)

              Conceptually, I think the script has to do this:


              Go to Layout (Receipts)

              # you are now on your original found set of records

              Go to record/request/page (First)


                   Set Variable ( $receiptId ; Receipt Primary Key)


                   Go To Layout (Prints)

                   Enter Find Mode

                   Set Field ( Receipt Foreign Key ; $receiptId

                   Perform Find


                   If (Get(LastError) = 0 )

                        Do Something...

                   End If


                   Go to Layout ( Receipts)

              # at this point you have switched context, but are still "on the record"  you began with before doing the search in Prints layout


              Go to record/request/page (Next ; Exit After Last)

              # at this point you are on the "next" record in Prints layout (your original found set) and have not yet done your search in the Prints layout with information on this record


              End Loop

              • 4. Re: Go to Next after Find?  Record missing (error 101)

                Your second Find, to relocate the record you started on, will locate only that record—presumably a found set of one. Thus Go to Next Record will fail, because there is no next record.


                If you want to loop through a set of records, you might consider employing a new window for all the "do stuff" part of your script, then going back to the original window when you are ready to move to the next record. This would look something like the following:


                Find whatever set you want to process

                Go to First Record


                Set Variables

                New window

                Do all the other stuff

                Close the second window

                Go to Next Record (NOTE: you will now be back in your original window with your original Found Set and record location unchanged, so this step will now make sense) – exit after last

                End Loop

                Do whatever other stuff you need to finish the process

                • 5. Re: Go to Next after Find?  Record missing (error 101)

                  Thanks for taking the time to understand and reiterate my logic.  I actually eliminated the 2 "Finds" (on Receipts) in the script. So I've got it looping.

                  Now, my biggest problem is when I switch from all numeric (999) to alphanumeric (A999) Image Types. This is the reason I decided to do a script in the first place.  When I related the Receipts to the Prints and tried to include data from prints in my layout for Receipts, Most of the match data for the Prints was missing. The data is related on fields Image and print number.


                  Although if I do a manual find on the layout "Expose Prints" using the same data as I am using in the script, I DO FIND these

                  records. And some of them actually do FIND. Bizarre.


                  Can anyone tell me why Filemaker will find a match for something like "401" but not "A401h"? 

                  • 6. Re: Go to Next after Find?  Record missing (error 101)

                    Where I say "and some of them actually do find", I meant to indicate that they find the records via the relationship.

                    • 7. Re: Go to Next after Find?  Record missing (error 101)

                      That is because FM searches for individual words commencing with the specified criteria. A401h does not commence with 401, hence is ignored. If you want to search for a string within a word you have to add wildcards (*): searching for *401* will find both.

                      • 8. Re: Go to Next after Find?  Record missing (error 101)

                        Thank you, Thank You, everyone!  I found that by putting asterisks around the whole variables that are like "A101h", by setting the variable = "*"&$$Image&"*", I was able to find these suckers.  That part was amazing, because I have searched and search for help with this issue!


                        I am looping, finding, and updating. Must be time to quit while I'm ahead!