B
BobRoyAce
I've got a text box, named txtDate, which has code associated with its
LostFocus event as shown below. When the control loses focus, this code is
entered as it should be. However, after the second code line runs (where
[Fiscal Week]'s value is set), the LostFocus event fires again. Just FYI,
[Fiscal Month] and [Fiscal Week] are both fields in the form's underlying
table which have invisible controls on the form that correspond to them. Why
does the LostFocus event keep firing?
--- CODE BEGINS ---
Private Sub txtDate_LostFocus()
[Fiscal Month] = DLookup("[Month Data]![System Month Number]", "[Month
Data]", "[Month Data]![Month Start Date] <= txtDate.Value And [Month
Data]![Month End Date] >= txtDate.Value")
[Fiscal Week] = DLookup("[Week Info]![WeekID]", "[Week Info]", "[Week
Info]![Start Date] <= txtDate.Value And [Week Info]![End Date] >=
txtDate.Value")
End Sub
LostFocus event as shown below. When the control loses focus, this code is
entered as it should be. However, after the second code line runs (where
[Fiscal Week]'s value is set), the LostFocus event fires again. Just FYI,
[Fiscal Month] and [Fiscal Week] are both fields in the form's underlying
table which have invisible controls on the form that correspond to them. Why
does the LostFocus event keep firing?
--- CODE BEGINS ---
Private Sub txtDate_LostFocus()
[Fiscal Month] = DLookup("[Month Data]![System Month Number]", "[Month
Data]", "[Month Data]![Month Start Date] <= txtDate.Value And [Month
Data]![Month End Date] >= txtDate.Value")
[Fiscal Week] = DLookup("[Week Info]![WeekID]", "[Week Info]", "[Week
Info]![Start Date] <= txtDate.Value And [Week Info]![End Date] >=
txtDate.Value")
End Sub