I have an access database bound to vbforms textboxes I want to check the date that the user inputs into the textbox or input box to make sure that time and date are not taken. the date and time are in the same field. the syntax displays the msgbox if the user inputs a date this is in use but if there is no match the appointment date in the first records updates. how do i get it to update the record that i am looking at.
Private Sub apptcheck()
Dim upDateAppt As String
upDateAppt = InputBox("Enter new appointment date and time", " _/_/__, _ am/pm"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
On Error GoTo errorhandler
datContactManager.Recordset.FindFirst "apptdate = #" & upDateAppt & "#"
On Error GoTo errorhandler
If (datContactManager.Recordset.NoMatch = False) Then
'msgbox display if date is not available
MsgBox "That appointment time is not Available"
Exit Sub
Else
txtAppointmentDate = upDateAppt
Exit Sub
End If
errorhandler:
Exit Sub
End Sub
Private Sub apptcheck()
Dim upDateAppt As String
upDateAppt = InputBox("Enter new appointment date and time", " _/_/__, _ am/pm"
On Error GoTo errorhandler
datContactManager.Recordset.FindFirst "apptdate = #" & upDateAppt & "#"
On Error GoTo errorhandler
If (datContactManager.Recordset.NoMatch = False) Then
'msgbox display if date is not available
MsgBox "That appointment time is not Available"
Exit Sub
Else
txtAppointmentDate = upDateAppt
Exit Sub
End If
errorhandler:
Exit Sub
End Sub