Hello
This is not a big problem, but I was hoping someone a bit more
knowlegable than I could explain something to me.
I have a simple function behind a form which writes changed values to
a table for tracking purposes :
Public Sub RecordChanges()
Dim strInsertValue As String
strInsertValue = "INSERT INTO
tblChanges(ChangedField,OldValue,NewValue,ChangeDa te,User,OrderNum)
VALUES ("
strInsertValue = strInsertValue & "'" &
Me.ActiveControl.Properties.Item(1) & "', '" &
Me.ActiveControl.OldValue & "', '" & Me.ActiveControl & "', #" & Date
& "#, '" & Forms("frmLogin")("txtUserName") & "', '" & Me.ORDER_NUMBER
& "')"
DoCmd.SetWarnings (False)
DoCmd.RunSQL strInsertValue
DoCmd.SetWarnings (True)
End Sub
This code works fine when it is behind the form in question, however I
tried to move the function to a module, for house-keeping, and because
I might want to use it in other forms.
I changed it slightly to:
Public Sub RecordChanges(sendingForm as Form)
And changed the "me"'s to "sendingForm"s, and assumed it would work,
however it doesn't and I get a type mismatch error.
Any idea why?
Cheers
Andrew