I have a from called CAD_CallDispSpl itF. As the name implies, it is a split form. The form has a subform named CAD_Log_DispF. Link Master Field is ID
Link Child Field is ID_Activity
The link works fine.
The record source for the subform is
I have this BeforeUpdate event on the subform.
Everything works fine up to the If syntax.
To spell it out in English, I will talk about only the first IF statement. What I want to happen is if the ActionID is 1 or 2 AND the DispDateTime field/control is empty, the the DispDateTime field/control should =Now(). If the DispDateTime field/control is not empty, then nothing should happen because I do not want it overwritten with a new date and time. If anyone can help me with the proper IF syntax, I can probably apply it to the other following IF statements. Thanks in advance..... Mark
Link Child Field is ID_Activity
The link works fine.
The record source for the subform is
Code:
SELECT CADLogT.ID, CADLogT.EntryDateTime, CADLogT.Notes, CADLogT.ActionID, CADLogT.Dispo, CADLogT.ID_Activity, CADLogT.EmployeeID, CADLogT.TourID, TourT.UnitAvailable, ActivityT.DispDateTime, ActivityT.EndingDateTime, ActivityT.BeginDateTime FROM (CADLogT INNER JOIN TourT ON CADLogT.TourID = TourT.ID) LEFT JOIN ActivityT ON CADLogT.ID_Activity = ActivityT.ID;
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer) Me.EmployeeID = DLookup("EmployeeID", "LocalUserT") If IsNull([EntryDateTime]) Then [EntryDateTime] = Now() End If Select Case ActionID.Value Case Is = 1: UnitAvailable = 0 Case Is = 2: UnitAvailable = 0 Case Is = 3: UnitAvailable = 0 Case Is = 4: UnitAvailable = 1 Case Is = 6: UnitAvailable = 1 Case Is = 7: UnitAvailable = 1 Case Is = 8: UnitAvailable = 1 Case Is = 10: UnitAvailable = 1 Case Is = 24: UnitAvailable = 1 End Select If IsNull([DispDateTime]) Then If ActionID = 1 Or 2 Then DispDateTime = Now() End If End If If IsNull([BeginDateTime]) Then If ActionID = 3 Then BeginDateTime = Now() End If End If If IsNull([EndingDateTime]) Then If ActionID = 6 Or 7 Or 8 Then EndingDateTime = Now() End If End If End Sub
To spell it out in English, I will talk about only the first IF statement. What I want to happen is if the ActionID is 1 or 2 AND the DispDateTime field/control is empty, the the DispDateTime field/control should =Now(). If the DispDateTime field/control is not empty, then nothing should happen because I do not want it overwritten with a new date and time. If anyone can help me with the proper IF syntax, I can probably apply it to the other following IF statements. Thanks in advance..... Mark
Comment