Hi all,
I have a form that before updating, I want to store the old value of one particular field. The original field is an integer, and I want to store the text description.
My code looks like this:
My original value of business term is 5914 - stored in OLD Business Term
My New value is 5915 - Stored in New business term.
What the DLOOKUP is doing - its populatating
DLookup("businesstermdesc" - From the new term
"BusinessTermID = " - From the new term
and then trying to match 5915 to my old term of 5914
Can anyone estabish what I have done incorrectly?
TIA
I have a form that before updating, I want to store the old value of one particular field. The original field is an integer, and I want to store the text description.
My code looks like this:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim FormName As String
Dim OldBusinessterm As Long
Dim testfield As Long
Dim NewBusinessTerm As Long
Dim NewRec As DAO.Database
Dim rstUpdate As DAO.Recordset
Dim MyBusinessTerm As Variant
OldBusinessterm = Me!BusinessTermID.OldValue
NewBusinessTerm = Me!BusinessTermID.Value
MyBusinessTerm = DLookup("businesstermdesc", "tblbusinessterm", "BusinessTermID = " & OldBusinessterm)
Set NewRec = CurrentDb
Set rstUpdate = NewRec.OpenRecordset("TblFieldTermLink")
rstUpdate.AddNew
rstUpdate("GTSBusinessTerm").Value = MyBusinessTerm
rstUpdate("BusinessTermID").Value = Me!BusinessTermID.Value
rstUpdate.Update
End Sub
My original value of business term is 5914 - stored in OLD Business Term
My New value is 5915 - Stored in New business term.
What the DLOOKUP is doing - its populatating
DLookup("businesstermdesc" - From the new term
"BusinessTermID = " - From the new term
and then trying to match 5915 to my old term of 5914
Can anyone estabish what I have done incorrectly?
TIA