Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter statement not found

Status
Not open for further replies.

corgette

Programmer
Mar 3, 2008
25
GB
One user out of over a hundred and fifty installations gets a "Parameter statement not found" error.

I was also just informed that this has been happening with each years application. (A new independaent version is released each year)

I believe it something on her system that is causing it. It has been happening each year and this year it was installed on a different stand alone PC.

Any ideas or links that can be helpful?

Thanks.
 
If that is Error 1238 it is pretty reproducable and I don't know another reason as a function called with a parameter that has no PARAMETERS/LPARAMETERS statement as it's first line of code.

So that's pretty easy to fix if you know the class/method or prg/procedure.

Bye, Olaf.
 
Thanks Olaf,

I don't know the error number. All their getting is a message that "Parameter statement not found" or "No Parameter statement found", as soon as the app is invoked.

If it was a missing param statemnt, It would happen to all users.
 
Since the other users aren't getting the error, my guess is that this particular user is somehow accessing an out of date version of the app, one that indeed has no PARAMETER/LPARAMETER statement. Is it possible to create and run a debugging version? If so, put something like

WAIT WINDOW "This is the correct program"

at the beginning, after the PARAMETER statement.


Jim
 
Is it a standard Foxpro error dialog (i.e. cancel/suspend)?

You do not have enough information to proceed. You should go about gathering that information. What kind of error handler do you have in place?
 
Corgette,

I strongly recommend you install a proper error-handler in the application -- one that will trap the error and record the error number, program name and line number where the error occurred.

This will tell you if this is indeed a standard VFP error. If it is, it could be that this particular user is performing some unusual sequence of steps, which other users don't do and therefore they don't see the error. Your error-handler should reveal that sort of information.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
It is possible that they are using a newer version of the runtime. VFP used to be pretty loose about not having commas between parameters, but that was tightened up in later versions.

Craig Berntson
MCSD, Visual FoxPro MVP,
 
Is this user perhaps running your app from a batch file rather than just a desktop shortcut? Could the batch file be trying to pass spurious parameters?

Even if it's a shortcut, I'd be suspicious that the shortcut is screwed up in some way.

Tamar
 
Thank you all for the response.

I am trying to get a scan shot of the error message and some more info regarding the OS etc.

For MikeLewis and danfreeman:
This is the error handler in use:

lcError = ABOX('RC','I',1, ;
+ 'Alias: ' + ALIAS() + CHR(13) ;
+ 'Error number: ' + LTRIM(STR(merror)) + CHR(13) ;
+ 'Error message: ' + MESS + CHR(13) ;
+ 'Line of code with error: ' + mess1 + CHR(13) ;
+ 'Program with error: ' + mprog + CHR(13) ;
+ 'Line number of error: ' + LTRIM(STR(mlineno)), 'Error' )

It is not being triggered. They get a message that "Variable lcError not found"

For TamarGranor and craigber:
They are running the correct version. I had them invoke the EXE from explorer. Same results.

Will be back with more info when available.
 
An error handler should be setup by ON ERROR. When do you do this in your start code? Maybe put that earlier.

Are there any calls and any branching of code on conditions like SYS(0), ID()? Anything that does not need user choices/input but differs with the user. If these call a parameterless function with parameters you got your reason.

What's ABOX()? is that a function for a messagebox call? Or is this some legacy foxpro function the newbie I am does not know?

Bye, Olaf.
 
Olaf,
These are the first three lines of code. There is no parameter statement as the prgram is called without any parameters.


PUBLIC merror, OleError, xInform
xInform = .T.

ON ERROR DO ErrHand WITH ERROR( ), MESSAGE( ), MESSAGE(1), PROGRAM( ), LINENO( )


ABOX is a function for calling MESSAGEBOX. Makes it much easier. Code is attached FYI. (As designed by Richard Coyle).

*************************************************
FUNCTION ABOX
PARAMETERS boxtype, xicon, DEFBUTT, messtext, ttext
PRIVATE diagtype, retval, maxbutts
IF PARAMETERS()<4
=MESSAGEBOX("Not enough parameters",16,"ABOX ERROR")
RETURN 0
ENDIF
IF PARAMETERS()<5
IF TYPE("_sysname")="U"
ttext=""
ELSE
ttext=_sysname
ENDIF
ENDIF
DO CASE
CASE UPPER(boxtype)=="OK"
diagtype=0
maxbutts=1
CASE UPPER(boxtype)=="OKCAN"
diagtype=1
maxbutts=2
CASE UPPER(boxtype)=="ARI"
diagtype=2
maxbutts=3
CASE UPPER(boxtype)=="YESNOCAN"
diagtype=3
maxbutts=3
CASE UPPER(boxtype)=="YESNO"
diagtype=4
maxbutts=2
CASE UPPER(boxtype)=="RC"
diagtype=5
maxbutts=2
OTHERWISE
=MESSAGEBOX("Invalid box type",16,"ABOX ERROR")
RETURN 0
ENDCASE
DO CASE
CASE UPPER(xicon) = "STOP"
diagtype=diagtype+16
CASE xicon = "?" .OR. UPPER(xicon) = "Q"
diagtype=diagtype+32
CASE xicon = "!"
diagtype=diagtype+48
CASE UPPER(xicon) = "I"
diagtype=diagtype+64
OTHERWISE
=MESSAGEBOX("Invalid icon",16,"ABOX ERROR")
RETURN 0
ENDCASE
DEFBUTT=MIN(DEFBUTT,maxbutts)
diagtype=diagtype+((DEFBUTT-1)*256)
retval=MESSAGEBOX(messtext,diagtype,ttext)
DO CASE
CASE UPPER(boxtype)="ARI"
retval=retval-2
CASE UPPER(boxtype)="YESNOCAN"
IF retval=2
retval=3
ELSE
retval=retval-5
ENDIF
CASE UPPER(boxtype)="YESNO"
retval=retval-5
CASE UPPER(boxtype)="RC"
IF retval=4
retval=1
ENDIF
ENDCASE
RETURN retval
****************************************
 
You are all over the place here, contradicting yourself left and right.

What does "It is not being triggered. They get a message that "Variable lcError not found"" mean? If it's not getting triggered how the heck are they getting an error?

And from what you've said, your error handler does nothing but create lcError and display it with Abox() or something like that which isn't an error handler by any stretch of the imagination, but elsewhere you say you have ON ERROR DO ErrHand, which IS AN ERROR HANDLER.

You couldn't possibly be any less clear about what's going on. I'm still not convinced this is a Foxpro error.
 
Corgette,

I *think* I have had this myself, one in a blue moon, just after an installation on the odd machine. It's like the application has loaded - but not really run the app, so much as a VFP environment, and then not run the code as expected - thus not firing the error handler.

I would try to get access as admin, or someone with admin rights, and thenwipe the application off the computer. I would then suggest rebooting and reinstalling - then rebooting again before running.

I've not found a common reason for this happening, but I have noticed it doesn't tend to happen on VFP9 so much, and have always suspected a over active anti-virus.

Good luck.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
For me it seems there is an error in your errorhandler and that get's displayed while the real error is "in disguise" this way.

What I'd like to see now is your ErrHand function, not only the ABOX() call.

Bye, Olaf.
 
Corgette,

As Dan says, your error-handler doesn't look at all right. Your ON ERROR looks OK, but what does ErrHand do? If it contains the call to your ABOX() function that you showed, I can't see how it could work. You are passing to ABOX() various variables, such as mlineno and mess1, but there's no indication of where these are coming from. Nor do I see what lcError is doing there.

Is this error-handler something you've been using for a while? Has it worked reliably in the past? If not, I really think you need to get the error handling sorted before you go too much further, as it will make it much easier to solve this sort of bug.

On another point. It's not clear if the missing parameter statement relates to parameters being passed into the application, perhaps from a shortcut or command-line argument, or whether it relates to a function or method call within the app. In other words, does the message come up as soon as you launch the app (before anything at all appears on the screen), or does it appear later?

In the former case, then the answer almost certainly has to do with the way in which the app is launched. As Tamar suggested, it might be from a batch file, or some other method that is specific to this user.

If, on the other hand, the missing parameter statement is internal to the app, you will need your error-handler to provide more information.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Mike, an error might be earlier before anything is displayed, but still after the ON ERROR activation of the ErrHand, if the ErrHand itself is missing a Parameter statement, then this would explain the error.

For example this would get you exaclty that error:

Code:
ON ERROR DO ErrHand WITH ERROR( ), MESSAGE( ), MESSAGE(1), PROGRAM( ), LINENO( )

Set tableprompt off
** any error, just for triggering the error handler
Use dhjklfhsdkfhkjdsdfsdfss

Procedure ErrHand()

abox() && simplified

Procedure Abox() 
messagebox("error") && simplyfied

What you get is "no parameter statement found".

If you add a parameter statement to ErrHand (and add the Abox() code including its call and the function itself, then in the next step you should get the real error displayed.

Bye, Olaf.
 
Olaf,

an error might be earlier before anything is displayed, but still after the ON ERROR activation of the ErrHand, if the ErrHand itself is missing a Parameter statement, then this would explain the error.

Yes, I know. I was trying to keep it simple. I was trying to distinguish between the lack of a parameter statement in the main program and in lower-level routines. But you're right that ErrHand itself might be missing the statement.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Here we go again. i'll try to respond in order of responses received.

danfreeman:
I meant the first message they're getting is not getting to the error handler. All the mesage says is "Program error. Parameter statement not found." I have asked for a screen shot so I can more exact.

The procedure ErrHand check for numerous errors by number and if the error is not trapped it displays info about the error. It is pretty much pasted from VFP's help file.

I'm sorry you're having trouble visualizing my problem, but I do agree with you that it probably is not a VFP error.

MikeLewis:
If the error is not trapped by the error number, the handler simply provides the line of code and environment info as to the cause. It has worked extremely reliably for many years.
The app is designed to start without any parameters passed. I tried having them run it from within windows explorer and it still happened. Once again, it is only happening in this one isolated case.

Olaf:

These are the first 2 lines in the error handler. . .

PROCEDURE ErrHand
PARAMETER merror, MESS, mess1, mprog, mlineno


The installation is in a different time zone, but I will follow up ASAP.
 
I tried having them run it from within windows explorer and it still happened.

Did you ewnsure they started the EXE and not some cmd/bat file that tries to pass parameters to your EXE?

Is there a config.fpw in the folder? Foxuser.dbf?

Bye, Olaf.
 
Olaf,
I specifically told them to double click the EXE.

The install includes a config.fpw file with the following:

SCREEN=OFF
codepage = 1252
TITLE = Universal Software Solutions, Inc.


The config.fpw included was last modified on 11/15/1998

I will try to get them to email me both these files.

Thanks,
Corgette
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top