Dear All,
I have the below code in a subform
It is tied to a beforeupdate event of a field called HolidayDate
When the code runs for the first time it is OK (displays the msgbox), but if I modify the HolidayDate then I get the Run-time error 3420 Object invalid or no longer set
Could you please advise?
nb. I tried the code at an afterupdate event as well, same error
Many thanks
I have the below code in a subform
It is tied to a beforeupdate event of a field called HolidayDate
When the code runs for the first time it is OK (displays the msgbox), but if I modify the HolidayDate then I get the Run-time error 3420 Object invalid or no longer set
Could you please advise?
nb. I tried the code at an afterupdate event as well, same error
Code:
Private Sub HolidayDate_BeforeUpdate(Cancel As Integer)
Dim rst As Recordset
Set rst = Me.RecordsetClone
rst.FindFirst "[HolidayDate] =" & Format(Me.HolidayDate, "\#mm\/dd\/yyyy\#")
If rst.NoMatch Then
Else
MsgBox "Ezt a napot már korábban felhasználtad!/You have already taken this day!", vbCritical
Me.Undo
Exit Sub
End If
rst.Close
...........
Many thanks