>>Why are you trying to add setup code to your menu?
>>My setup code is in my MAIN.PRG in vfp50.
>
>I have a bunch of forms that get called from the menu and I need to pass
>them the account number for the records I need displayed. All I'm trying to
>do in the setup code of the menu is pass it the account number. I'd prefer
>to do it as a parameter but I can also do it as a PUBLIC variable.
>
>The problem is that, when the Menu Designer is up, I select View | General
>Options from its menu, select Setup Code and click on OK like the developer
>guide says. I can enter the line but, when I save it and generate the MPR,
>the line I entered is missing.
>
>
>Gary J. Sibio
Gary,
The menu setup code won't work for you, it only runs once when you DO Menu.mpr and never runs again. There is no way to get the parameter you want into the menu to be passed on to the called form, so you'll need to develop a another way to get that parameter into the form.
One way would be to based all of your forms from a class that has a setpointer method, let setpointer accept a parameter for the recno() to position on. Also add a launchform method to the fomr class, have the menu code check if _screen.activeform is a fomr and if it is send the launchform method of that form a message to launch the form;
* Menu procedure
IF TYPE("_screen.ActiveForm.Name") = "C"
_screen.activeform.LaunchForm("The one you want")
ELSE
DO FORM TheOneYouwant
ENDIF
In the fomr classes LaunchForm put something like this;
LPARAMETERS pcForm
LOCAL loForm
DO FORM (pcForm) NAME loForm
loForm.SetPointer(RECNO("Customer"))