Okay, I've searched the message board but I must not be entering the search term right. I can't seem to find anything that would give me a clue how to email the current record as a PDF, when the Submit button is clicked.
The code I have kind of works, but I get the first record in the table, not the current one. I'm sure its my query filter but no matter what syntax I try, I either get an error and no report is generated, or I get the first record in the table attached to the email message in the report.
Any help you all could provide would be GREATLY appreciated!
I have a data entry page (a5w page) with the following code on the web component AfterUpdate section:
function AfterUpdateRecords as v (Args as P, PageVariables as P)
with PageVariables
dim tbl as p
dim cid as c
dim session.__protected__user as c
dim session.__protected__trx as c
dim session.__protected__email as c
tbl=table.open("[PathAlias.ADB_Path]\requests.dbf")
Current_Record = tbl.recno()
query.filter = "recno() =" + var->Current_Record
query.order = ""
filename = session.session_folder + chr(92) + "New_Element_Request.pdf"
report.saveas("New_Element_Request@[PathAlias.ADB_Path]\requests.ddd","PDF", query.filter, query.order,filename, .f.)
if file.exists(filename)
response.redirect(session.session_url + "New_Element_Request.pdf?" + time("hms3"))
end if
DIM ps as P
DIM pm as P
e_attach = filename
pm.from = "[email protected]"
pm.from_alias = "New Element Request System"
pm.to = "[email protected]"
pm.subject = "New Element Request Added"
pm.message = ""
pm.attachments = e_attach
'optional header fields
pm.lRelated = .F.
' send message
IF email_smtp_open(ps, "emailserver.domain.com" ,25 , "userid" , "******")
email_smtp_send(pm, ps)
END IF
Email_smtp_close(ps)
end with
end function
Thanks!!
The code I have kind of works, but I get the first record in the table, not the current one. I'm sure its my query filter but no matter what syntax I try, I either get an error and no report is generated, or I get the first record in the table attached to the email message in the report.
Any help you all could provide would be GREATLY appreciated!
I have a data entry page (a5w page) with the following code on the web component AfterUpdate section:
function AfterUpdateRecords as v (Args as P, PageVariables as P)
with PageVariables
dim tbl as p
dim cid as c
dim session.__protected__user as c
dim session.__protected__trx as c
dim session.__protected__email as c
tbl=table.open("[PathAlias.ADB_Path]\requests.dbf")
Current_Record = tbl.recno()
query.filter = "recno() =" + var->Current_Record
query.order = ""
filename = session.session_folder + chr(92) + "New_Element_Request.pdf"
report.saveas("New_Element_Request@[PathAlias.ADB_Path]\requests.ddd","PDF", query.filter, query.order,filename, .f.)
if file.exists(filename)
response.redirect(session.session_url + "New_Element_Request.pdf?" + time("hms3"))
end if
DIM ps as P
DIM pm as P
e_attach = filename
pm.from = "[email protected]"
pm.from_alias = "New Element Request System"
pm.to = "[email protected]"
pm.subject = "New Element Request Added"
pm.message = ""
pm.attachments = e_attach
'optional header fields
pm.lRelated = .F.
' send message
IF email_smtp_open(ps, "emailserver.domain.com" ,25 , "userid" , "******")
email_smtp_send(pm, ps)
END IF
Email_smtp_close(ps)
end with
end function
Thanks!!
Comment