SOLVED

AfterUpdate and If statement

Super Contributor

Hello Experts, 

 

I need a msgbox to appear if the date I enter [FundingDate] equals any of the values in qryHolidays.Date.  I get an Object Required error.  I am not sure where the error is?

 

thank you

 

Private Sub FundingDate_AfterUpdate()

If Me.FundingDate = qryHolidays.Date Then
     MsgBox "Holiday", vbInformation
Else

End If

End Sub

 

Tony2021_0-1650194315526.png

 

2 Replies
best response confirmed by Tony2021 (Super Contributor)
Solution
you can use DLookup:

If DCount("1", "qryHolidays", "Date = " & Format$(Me.FundingDate, "\#mm\/dd\/yyyy\#")) <> 0 Then
MsgBox "Holiday", vbInformation
End If
Perfect! thank you Arnel. Happy holidays..