Tracking Changes made to hyperlink fields ms access -
i using code below audit changes made subform. when code run hits object , receive error says "operation not supported type of object". assume due fact 1 of fields checking hyperlink.
should work hyperlinks? , if not, there way keep hyperlink without having convert text , still checked? not believe entirely important keep hyperlink since field contains email addresses made sense have hyperlink.
edit
turns out more hyperlink field causing issue. have gone through debugger unsure 1 raising issue. loops through @ least 5 times before error raised.
to give credit credit due, following code had similar question asked.
access 2010 audit trail on subforms
any or workaround appreciated.
option compare database option explicit sub auditchanges(idfield string, useraction string) on error goto auditchanges_err dim cnn adodb.connection dim rst adodb.recordset dim ctl control dim dattimecheck date dim struserid string 'added code dim subformname string set cnn = currentproject.connection set rst = new adodb.recordset rst.open "select * tblaudittrail", cnn, adopendynamic, adlockoptimistic dattimecheck = now() struserid = environ("username") 'msgbox display name (just test code) msgbox (" " & screen.activeform.name & " ") 'if statement check if user using form subform if screen.activeform.name = "frmcontactmenu" subformname = "subfrmcontactdisplay" 'msgbox (" " & screen.activeform.name & " ") select case useraction case "edit" each ctl in forms![frmcontactmenu]![subfrmcontactdisplay].form if ctl.tag = "audit" if nz(ctl.value) <> nz(ctl.oldvalue) rst .addnew ![datetime] = dattimecheck ![username] = struserid ![formname] = subformname ![action] = useraction ![recordid] = forms![frmcontactmenu]![subfrmcontactdisplay].form![idfield].value ![fieldname] = ctl.controlsource ![oldvalue] = ctl.oldvalue ![newvalue] = ctl.value .update end end if end if next ctl case else rst .addnew ![datetime] = dattimecheck ![username] = struserid ![formname] = subformname ![action] = useraction ![recordid] = forms![frmcontactmenu]![subfrmcontactdisplay].form![idfield].value .update end set ctl = nothing end select else select case useraction case "edit" each ctl in screen.activeform.controls if ctl.tag = "audit" if nz(ctl.value) <> nz(ctl.oldvalue) rst .addnew ![datetime] = dattimecheck ![username] = struserid ![formname] = screen.activeform.name ![action] = useraction ![recordid] = screen.activeform.controls(idfield).value ![fieldname] = ctl.controlsource ![oldvalue] = ctl.oldvalue ![newvalue] = ctl.value .update end end if end if next ctl case else rst .addnew ![datetime] = dattimecheck ![username] = struserid ![formname] = screen.activeform.name ![action] = useraction ![recordid] = screen.activeform.controls(idfield).value .update end end select end if auditchanges_exit: on error resume next rst.close cnn.close set rst = nothing set cnn = nothing exit sub auditchanges_err: msgbox err.description, vbcritical, "error!" resume auditchanges_exit end sub
Comments
Post a Comment