![]() |
Sergey Kornilov admin 3/2/2006 |
There is a bug in sample code. See my changes in bold. Function BeforeEdit(dict, where) ' Parameters: ' dict - Scripting.Dictionary object. ' Each field on the Edit form represented as 'Field name'-'Field value' pair ' where - string with WHERE clause pointing to record to be edited '** Send email with old data record **** ' do not forget to setup email parameters like From, SMTP server etc ' on 'Security->User login settings' dialog set rsOld = CreateObject("ADODB.Recordset") email="test@test.com" message="" subject="Sample subject" ' modify the following SQL query to select fields you like to send rsOld.Open "select * from " & strTableName & " where " & where, dbConnection if not rsOld.eof then for i=0 to rsOld.Fields.Count-1 if not IsBinaryField(rsOld.Fields(i)) then _ message = message & rsOld.Fields(i).Name & " : " & rsOld(rsOld.Fields(i).Name) & vbcrlf next rsOld.Close end if set rsOld = Nothing sendmail email, subject, message BeforeEdit = True ' set BeforeEdit to True if you like to proceed with editing this record ' set it to False in other case End Function |