Hi there,
My DB is a daily log with a form which is searchable by using another form with a calendar control/combobox using code below;
Dim rst As DAO.Recordset
Dim strDate As String
If IsNull(cboDate) Then
Exit Sub
Else
' Set the combobox value as the recordsource for the form
strDate = "#" & Format(Me.cboDate, "mm\/dd\/yy") & "#"
Set rst = Forms!frmDailyLog.Recordset.Clone
rst.FindFirst "dtmDate= " & strDate
If Not rst.EOF Then
Forms!frmDailyLog.Bookmark = rst.Bookmark
End If
End If
' Close the form
DoCmd.Close acForm, "frmSelectDate"
My question is this;
If a date is selected which is outside the date range of recordset how can I get a Message Box to pop up and tell the user this then exit the sub? Currently it just goes to the 1st record.
Cheers,
millrat
My DB is a daily log with a form which is searchable by using another form with a calendar control/combobox using code below;
Dim rst As DAO.Recordset
Dim strDate As String
If IsNull(cboDate) Then
Exit Sub
Else
' Set the combobox value as the recordsource for the form
strDate = "#" & Format(Me.cboDate, "mm\/dd\/yy") & "#"
Set rst = Forms!frmDailyLog.Recordset.Clone
rst.FindFirst "dtmDate= " & strDate
If Not rst.EOF Then
Forms!frmDailyLog.Bookmark = rst.Bookmark
End If
End If
' Close the form
DoCmd.Close acForm, "frmSelectDate"
My question is this;
If a date is selected which is outside the date range of recordset how can I get a Message Box to pop up and tell the user this then exit the sub? Currently it just goes to the 1st record.
Cheers,
millrat