Ok, this works but I'm positive this is not the best way to code it. What would be a good way to clean this up?
Code:
Private Sub cmbSlotID_BeforeUpdate(Cancel As Integer)
If Not IsNull(DLookup("[SlotID]", "Data", "[SlotID] = 'OA' AND [Start Date]=#" & Me.txtStart_Date & "#")) Then
MsgBox "In House Repairs are scheduled for all day. No time slots are available."
Cancel = True
End If
If Me.cmbSlotID.Value = "OA" And Not IsNull(DLookup("[SlotID]", "Data", "[SlotID] = 'O1' AND [Start Date]=#" & Me.txtStart_Date & "#")) Then
MsgBox "Customer Repairs are already scheduled for today. An All Day event cannot be scheduled. "
Cancel = True
End If
If Me.cmbSlotID.Value = "OA" And Not IsNull(DLookup("[SlotID]", "Data", "[SlotID] = 'O2' AND [Start Date]=#" & Me.txtStart_Date & "#")) Then
MsgBox "Customer Repairs are already scheduled for today. An All Day event cannot be scheduled. "
Cancel = True
End If
If Me.cmbSlotID.Value = "OA" And Not IsNull(DLookup("[SlotID]", "Data", "[SlotID] = 'O3' AND [Start Date]=#" & Me.txtStart_Date & "#")) Then
MsgBox "Customer Repairs are already scheduled for today. An All Day event cannot be scheduled. "
Cancel = True
End If
If Me.cmbSlotID.Value = "OA" And Not IsNull(DLookup("[SlotID]", "Data", "[SlotID] = 'O4' AND [Start Date]=#" & Me.txtStart_Date & "#")) Then
MsgBox "Customer Repairs are already scheduled for today. An All Day event cannot be scheduled. "
Cancel = True
End If
If Me.cmbSlotID.Value = "OA" And Not IsNull(DLookup("[SlotID]", "Data", "[SlotID] = 'O5' AND [Start Date]=#" & Me.txtStart_Date & "#")) Then
MsgBox "Customer Repairs are already scheduled for today. An All Day event cannot be scheduled. "
Cancel = True
End If
End Sub