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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Local Parameters

Status
Not open for further replies.

DaveL

Programmer
Jun 8, 2000
40
US
I am trying to set and pass a local parameter from a form to a program that runs an SQL / report.

Click Event Code
Code:
parm1 = ThisForm.formvar1.Value
parm2 = ThisForm.formvar2.Value
parm3 = ThisForm.formvar3.Value
DO procedure1 WITH parm1, parm2, parm3

Program Code
Code:
PROCEDURE procedure1
LPARAMETERS parm1, parm2, parm3

SELECT fielda ;
FROM filea ;
WHERE fielda = parm3 ;

I am getting an "SQL: Column 'parm3' is not found error? Is there a trick to referencing local parameters within an SQL statement?? What am I missing?

Thanks

 
I suggest...
SELECT fielda ;
FROM filea ;
WHERE fielda = (parm3)

The reason is I am not sure if you are using this outside of the function, and if UDFPARMS are set to Value. If parm3 is not available ouside this function, the cursor will not get the variable outside the function. I have not tried this but. If you still get error, I will test and let you know. I hope you are not ending the SQL with ";" ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
I think I found the problem? I am calling another Procudure within the same program and I was not passing the Local Variable to that procedure. Since I was not passing parm3 to procedure2, it was not available for the SQL. Does that sound right?

Thanks.

Code:
PROCEDURE procedure1
LPARAMETERS parm1, parm2, parm3

DO procedure2

PROCEDURE procedure2
SELECT fielda ;
FROM filea ;
WHERE fielda = parm3 ;
RETURN

RETURN
 
LPARAMETERS means Local Parameters :) Yes, you've found the problem :) Grigore Dolghin
Class Software
Bucharest, Romania
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top