Data validation rule in VBA

vinwin06

Registered User.
Local time
Today, 17:50
Joined
Sep 1, 2011
Messages
17
Hello,

I have below codes on my form to restrict the user for data validation for entering the date.

Code:
Dim strSQL As String

strSQL = "SELECT Max([Requisition_table]![SAPRequisitionReleaseDate]) AS Max_Date"
 strSQL = strSQL & " FROM Master_data INNER JOIN Requisition_table ON Master_data.Tender_Number = Requisition_table.Tender_NO"
 strSQL = strSQL & " WHERE Tender_NO = """ & Me!Tender_Number & """"
 
 
 
    With CurrentDb.OpenRecordset(strSQL)
    If Not IsNull(!max_date) Then
        If ((Me!Tender_Number_date) >= (!max_date)) Then
            Cancel = True
            MsgBox "Date must be Greater than: " & !max_date, vbExclamation
        End If
    End If
    .Close  ' close the recordset
End With

question in this code i have given the criteria as greater than or equal to , while i am entering the equal to date also i am getting error message that i need to enter the later date. How i can mention that in this codes.
 
Just Hover Mouse over the Code using Breakpoint and see if the format of date is correct or not. It will be a clear picture to you.
 

Users who are viewing this thread

Back
Top Bottom