I have a dialog with an advanced button named vR1 with the following code in the button's Server OnClick event:
This code works correctly and prints the report.
BUT, when I wrap the code in a function in the dialog's Server Declarations event:
And put this code in the button's Server OnClick event:
PrintAvery5160("R01")
I get an error message stating:
"Error in event handler code for OnClick event for 'vR1': Not found
session not found."
Apparently the OnClick doesn't recognize the session.session_folder variable in the function.
???
Code:
vFilename = "" vOrder = "" vFilter = "" Dim Global vLabel as C = "R01" Dim vFilename as c vFilename = session.session_folder + chr(92) + "Avery5160.pdf" vFilename = report.saveas("Avery5160@[PathAlias.ADB_Path]\AddressBook.DDD","pdf",vFilter,vOrder,vFilename,.f.) if file.exists(vFilename ) response.redirect(session.session_url + "Avery5160.pdf?" + time("hms3")) end if
BUT, when I wrap the code in a function in the dialog's Server Declarations event:
Code:
FUNCTION PrintAvery5160 AS V (vLabelx as C) vFilename = "" vOrder = "" vFilter = "" Dim Global vLabel as C = vLabelx Dim vFilename as c vFilename = session.session_folder + chr(92) + "Avery5160.pdf" vFilename = report.saveas("Avery5160@[PathAlias.ADB_Path]\AddressBook.DDD","pdf",vFilter,vOrder,vFilename,.f.) if file.exists(vFilename ) response.redirect(session.session_url + "Avery5160.pdf?" + time("hms3")) end if END FUNCTION
PrintAvery5160("R01")
I get an error message stating:
"Error in event handler code for OnClick event for 'vR1': Not found
session not found."
Apparently the OnClick doesn't recognize the session.session_folder variable in the function.
???
Comment