I am some serious need of some help. I have a form where users sign in each day. I have a stop to keep users from signing in more than once. However, if the user tries to sign in more than once, after the error message pops up, the user hits "OK", and the record is still created in the database. I need to either stop that blank record from being created, or delete it once it is created (without the user receiving an error message of any kind). I have included the code in the "Before Update" procedure. Any help on this will be much appreciated.
Code:
Private Sub Combo42_BeforeUpdate(Cancel As Integer)
Dim dbTemp As Database
Dim rsTemp As DAO.Recordset
Set dbTemp = CurrentDb()
Set rsTemp = dbTemp.OpenRecordset("SELECT * FROM tblTimeTrack" _
& " WHERE " _
& "Name = '" & Me.Combo42.Value & "'" _
& " AND Date = #" & Format(Me.Date.Value) & "#" _
)
If Not rsTemp.EOF Then
Combo42.Undo
Cancel = MsgBox("You have already signed in today, Please use Name Lookup.", _
vbCritical, "Cannot save")
End If
rsTemp.Close
Set rsTemp = Nothing
End Sub