I am trying to follow the info here about Inserting a Row Into a SQL Database, p. 22: http://www.alphasoftware.com/whitepa...chitecture.pdf
I'm trying to just append an audit record about a deletion into my back end Access database. In the code below, the connection has already been opened, etc. The piece of code shown here produces a fatal error (which doesn't surprise me since I'm such an Alpha newbie). I've been studying everything I can find about INSERT INTO and am now throwing my appeal for help to the message board. Thanks.
I'm trying to just append an audit record about a deletion into my back end Access database. In the code below, the connection has already been opened, etc. The piece of code shown here produces a fatal error (which doesn't surprise me since I'm such an Alpha newbie). I've been studying everything I can find about INSERT INTO and am now throwing my appeal for help to the message board. Thanks.
Code:
'append an audit record about the Cost Type(PROD_CODE) deletion to the TblGLAudit 'NOTE: PROD_CODE value from TblProducts is appended to AP_PRODUCT_ID field in TblGLAudit dim sqlaudit as c sqlaudit = "INSERT INTO TblGLAudit(GL_JOURNAL, GL_DATE, GL_MAIN_ACCT_NUM, GL_DESCRIPTION, AP_PRODUCT_ID, GL_ENTRY_NOTES, AUDIT_DATE, USER_NAME) VALUES (:GL_JOURNAL, :GL_DATE, :GL_MAIN_ACCT_NUM, :GL_DESCRIPTION, :AP_PRODUCT_ID, :GL_ENTRY_NOTES, :AUDIT_DATE, :USER_NAME)" delete args dim args as sql::arguments 'set the value of the arguments. 'NOTE: If field is a numeric field, the code would have to be like this (per Selwyn): 'args.add("whatCriteria", convert_type( FieldName, "N") ) 'ones I wonder about are the date and time fields... dim AuditValue as c AuditValue = e._currentRowDataOld.PROD_CODE dim AuditNote as c AuditNote = "User confirmed deletion of Cost Type: "+ AuditValue args.add("GL_JOURNAL", "NONE") args.add("GL_DATE",Date) 'today's date? is this right? need to convert to character? args.add("GL_MAIN_ACCT_NUM","0") 'GL_MAIN_ACCT_NUM is a text field args.add("GL_DESCRIPTION","Cost Type Deletion Request") args.add("AP_PRODUCT_ID",AuditValue) args.add("GL_ENTRY_NOTES", AuditNote) args.add("AUDIT_DATE",Now) 'date and time? is this right? need to convert to character? args.add("USER_NAME","Alpha Test") 'execute the audit append query with a flag to let us know if the query was executed successfully. flag = cn.Execute(sqlaudit,args)
Comment