Code:
For Each txtCtrl In Me.Controls
If txtCtrl.ControlType = acTextBox Then
If txtCtrl.Locked = True Then
GoTo myNext
End If
table = "InternsTracker"
RecID = Me.ID
'Debug.Print txtCtrl.Name
oldVal = txtCtrl.OldValue
newVal = txtCtrl.Value
If IsNull(oldVal) = True And IsNull(newVal) = False Then
field = txtCtrl.Name
Call ChangeTrack(table, field, RecID, oldVal, newVal, changeDate, user, Form)
ElseIf IsNull(oldVal) = False And IsNull(newVal) = True Then
field = txtCtrl.Name
Call ChangeTrack(table, field, RecID, oldVal, newVal, changeDate, user, Form)
ElseIf oldVal <> newVal Then
field = txtCtrl.Name
Call ChangeTrack(table, field, RecID, oldVal, newVal, changeDate, user, Form)
End If
ElseIf txtCtrl.ControlType = acComboBox Then
If txtCtrl.Locked = True Then
GoTo myNext
End If
If txtCtrl.Name = "cobIntYear" Then
GoTo myNext
End If
table = "InternsTracker"
RecID = Me.ID
oldVal = txtCtrl.OldValue
newVal = txtCtrl.Value
If IsNull(oldVal) = True And IsNull(newVal) = False Then
field = txtCtrl.Name
Call ChangeTrack(table, field, RecID, oldVal, newVal, changeDate, user, Form)
ElseIf IsNull(oldVal) = False And IsNull(newVal) = True Then
field = txtCtrl.Name
Call ChangeTrack(table, field, RecID, oldVal, newVal, changeDate, user, Form)
ElseIf oldVal <> newVal Then
field = txtCtrl.Name
Call ChangeTrack(table, field, RecID, oldVal, newVal, changeDate, user, Form)
End If
ElseIf txtCtrl.ControlType = acCheckBox Then
If txtCtrl.Locked = True Then
GoTo myNext
End If
If txtCtrl.Name = "Clearance Status" Then
table = "PartInfo"
RecID = Me.SMART_ID
Else
table = "InternsTracker"
RecID = Me.ID
End If
oldVal = txtCtrl.OldValue '<----This is where the error occurs
newVal = txtCtrl.Value
If oldVal <> newVal Then
field = txtCtrl.Name
Call ChangeTrack(table, field, RecID, oldVal, newVal, changeDate, user, Form)
End If
End If
myNext:
Next txtCtrl
Exit Sub
Thanks,