I'm not sure of the order or syntax of what I need here.
The user intends to remove a Personal Day that they have scheduled from their calendar. The user enters a date that they have a Personal Day scheduled and pushes a button to delete it. I want to check to make sure they actually have a Personal Day scheduled on the day they input. If the date enters matches a date they have scheduled, I want to get out of the loop and continue on in the macro. If after the dates scheduled are all checked, none match the date entered, I want to tell the user, "You do not have a Personal Day scheduled on this date."
Here's what I have and I'm getting a Loop without Do error:
Dim NoPD As Recordset
Set NoPD = CurrentDb.OpenRecordset("PersDaySch")
With NoPD
Do Until .EOF
If txtAddP = [SFPersDaySch].Form![EventDate] Then
Exit Do
.MoveNext
Loop
Else
MsgBox "You do not have a Personal Day scheduled on this date."
Exit Sub
End With
Any pointers are greatly appreciated!
The user intends to remove a Personal Day that they have scheduled from their calendar. The user enters a date that they have a Personal Day scheduled and pushes a button to delete it. I want to check to make sure they actually have a Personal Day scheduled on the day they input. If the date enters matches a date they have scheduled, I want to get out of the loop and continue on in the macro. If after the dates scheduled are all checked, none match the date entered, I want to tell the user, "You do not have a Personal Day scheduled on this date."
Here's what I have and I'm getting a Loop without Do error:
Dim NoPD As Recordset
Set NoPD = CurrentDb.OpenRecordset("PersDaySch")
With NoPD
Do Until .EOF
If txtAddP = [SFPersDaySch].Form![EventDate] Then
Exit Do
.MoveNext
Loop
Else
MsgBox "You do not have a Personal Day scheduled on this date."
Exit Sub
End With
Any pointers are greatly appreciated!
Last edited: