How do I in Filemaker create a script to find next months month name?

I am running FileMaker 10.
I created a button that when clicked it should search a table with the field called "BdayMonth".
The script should use the next month and compare it to the field "BdayMonth" and display those names.
Right now the script that runs when the button is clicked is:
New Window
Goto layout
Set Variable [$NextMonth; Value:_Contacts::cc_NextMonthDayMonth]
Enter Find mode []
Set Field[_Contacts::bDayMonth; $NextMonth]
Perform Find[]
Enter Preview Mode[]
Print Setup[Restore]
Print[Restore]
CLose Window[Current Window]
---------------------------------------------------

Where I created the parameters: "NextMonth" & "months"
----------------------------------------
The code worked for the month of March when it was clicked it displayed the records that the month was "April" in the field "bDayMonth" in the "Contacts" table.
But now in the month of "April" when I click onthe button, it still displays the records for "April".

Yes, I need it to when clicked gather all the records that the month is the next month so we can print out labels to mail them a birthday card.
Months ahead is a function. the code is above it is:
Let(
[guess = Date(Month(NextMonth) + months; Day(NextMonth); Year(NextMonth));
expectedMonth = Mod(Month(NextMonth) + months - 1; 12) + 1];

If ( Month(guess) = expectedMonth; guess; Date(Month(NextMonth) + months + 1; 1; Year(NextMonth)) - 1 )
)
-----
I accidently said that the name of the functions is : monthName

I don't know what is "months", but this is weird to me as I understand that if the month of guess is the expected one, you keep the guess date, and if not, you pick up the next month date. what for? do I miss something? who made this function? do you have the equiv in human language?
is that supposed to get the next month name? or more?

What I need the code to do is that when ever the user clicks on the birthday card button is to make a variable the value of the next month. Then that value will be compared to all records to search in the "bDayMonth" field of the "Contacts" table to search for the value of the variable that is the next month. For example, say we are in the month of April. The variable should retrieve the value of "May". I need a variable with that value because I have two other scripts that use that value. So when the button is clicked it will look for any record that has the value of "May" in the "bDayMonth" field from the "Contacts" table. If we are in the month of May, it should pull up the records that the birth month is June. That is what I need it to do.

Make a global text field and store the value in that as part of the script, then in the 'Enter Find Mode / Set Field ....' section you can use the global field to set the search criteria in the Set Field step. Remember to clear the global field at the end of the script.

As it's a *global* text field, you can put this in any table you like and you will be able to grab the value in it regardless of which layout (table occurrence context) you are on.

why do you want to store it?
the var is text, always in fm. to calc its value, use tocacar's formula whihc is correct.
you can use it directly by searching the date field in contacts=
$var & "-*-*"
if - is you regional date separator with the US date format.
change this if you use another format. European french format would be:
"*/" & $var & "/*"

lesouef: I thought that also, but then I thought he may be better off storing the value in a global field as he says he uses the currentmonth+1 value in two other scripts.

j_rameses: Don't worry about clearing the global field - I see above that you want to use this value again in other scripts. The best time/ place to save this value in the global field would be as part of a script that runs automatically when a user logs in. The script (call it 'login' if you like) should have the following steps:

set variable $myvariable = use the calc I provided above
set Field [<my global field>] = $myvariable

To have this script run automatically whenever someone logs in, go to File/ File Options and select the script to run at login (the settings to select are obvious).

You will now be able to access this value throughout the user session, and use it in any script you like.

An alternative to using a global field is to instead just create a global variable. You do this using two "$" signs in front of the variable name:

$$myvariable (is global)
$myvariable (is local)

Either option will suit your purposes just fine, but if you go the global variable route, remember to always have 2 dollar signs ($$) in front of the variable name.

1. Make a brand new global field, stored your global table, called 'NextMonth' (this is a text field set to have global storage). You are going to use this field in your scripts.

2. Make a script called 'Log In Script' with the following two steps:

set variable $myvariable = use the calc I provided above
set Field [<my global field>] = $myvariable

If you already have a script set to run at login, just include these two steps in it. If you don't already have a script set to run at login, create one, as mentioned above, and then go to File/ File Options and select it to run when the file is opened (i.e., when the user logs in); the settings to choose are obvious.

2. With that done, close the file, then log back in. Your global field 'NextMonth' now has the name of next month stored in it.

$myvariable = use that name or come up with my own?
-------------------------------
use the calc I provided above = MonthName(Date(Month( Get ( CurrentDate) ) + 1;Day(Get ( CurrentDate));Year(Get ( CurrentDate))))
--------------------------------
[<my global field>] = should this be a different name i create or is it "NextMonth" & do i have to use the "<>" symbols

oops i hit the submit button.
i continuation to the above:
set Field [@-Globals::NextMonth] = $myvariable
Where do I put the value "$myVariable"?
Do I click on "CaLCULATED Result" button and enter the value "$myVariable"

I don't understand your apparent confusion. You are asking questions about script steps that are already familiar to you, as you demonstrate in your original question.

To display the value of the global field on the button, in Layout Mode, go to Insert/Merge Field and select the global field from the list. You can add any other text you want by simply typing it, using the keyboard.

Conversion Steps for merging and consolidating separate Filemaker files
The following is a step-by-step guide for the process of consolidating two or more FileMaker files (version 7 and later) into a single file with multiple tables. Sometimes th…

Problem: You have a hosted FileMaker database and users are tired of having to use Open Remote or Open Recent to access the database. They say, "can't you just give us something to double-click on rather than have to go through those dialogs?"
An…

Planning to migrate your EDB file(s) to a new or an existing Outlook PST file?
This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…

This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.
Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …