'TIP: You can encrypt this file when it is saved, or password protect it, by adding a special comment to the first line of the file (with no leading spaces). 'To encrypt the file, set the comment on the first line to: 'ENCRYPTED 'To password protect the file (which will also encrypt it), set the comment on the first line to: 'PASSWORD:your_password_phrase 'To create a compiled AEX library (when this project is published), add the comment 'COMPILEAEX anywhere in the code. '-- '-- Demo Module '-- function updateRACTassigned as C (ractassigned as C, supplierid as N) on error goto error_databaseupdate dim cn as sql::connection dim flag as l flag = cn_open(cn,"::Name::Cust_Connection") if flag = .f. then 'there was an error dim errorText as c errorText = cn.callresult.text error_generate(errorText) end end if 'turn on portable SQL cn.PortableSQLEnabled = .t. dim SQL as c sql = "UPDATE tblDisposedItems_ewaste SET RACT_Assigned = :RACTAssigned WHERE RACT_Assigned LIKE 0 AND SupplierID = :SupplierID" dim args as sql::arguments args.add("RACTAssigned",ractassigned) args.add("SupplierID",supplierid) '-- SQL from Access - dw '-- UPDATE tblDisposedItems_ewaste SET tblDisposedItems_ewaste.RACT_Assigned = [Forms]![frmSACT_Border]![frmSACTNumbers_Full_Admin].[Form]![cntSACTNumber] '-- WHERE (((tblDisposedItems_ewaste.RACT_Assigned)="0") AND ((tblDisposedItems_ewaste.SupplierID)=[TempVars]![CurrentSupplierID])); '-- 'execute the SQL flag = cn.execute(sql,args) 'debug(1) if flag = .f. then 'there was an error dim errorText as c errorText = cn.callresult.text error_generate(errorText) cn.close() end end if dim rowsUpdated as n 'get the number of rows that were updated rowsUpdated = cn.CallResult.rowsaffected cn.close() 'showvar("Rows that were updated: " + rowsUpdated) updateRACTassigned = "Rows that were updated: " + rowsUpdated end error_databaseupdate: 'debug(1) err = error_code_get() linenumber = error_line_number_get() msg = error_text_get(err) 'showvar(msg) updateRACTassigned = msg end end function exports.updateRACTassigned = updateRACTassigned