Follow this step...
Add ODBC in your Components
Select "Microsoft ADO Data Control 6.0 (OLEDB)"
Drag "Adodbc1" in to you VB Form
Open your Command Button and paste this code.
Public rst As New ADODB.Recordset
Private Sub Command1_Click()
Set dbcon = New ADODB.Connection
dbcon.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=myDBRecords"
If rst.State = 1 Then rst.Close
strsql = "select * from tblrecords where mydate='" & DTPicker1.Value & "'"
rst.Open strsql, dbcon, adOpenKeyset, adLockOptimistic
While Not rst.EOF
If DTPicker1.Value = rst!mydate Then
MsgBox "The Date Already Exists!", , "Success"
Exit Sub
Else
MsgBox "The Date not Found!", , "Error"
End If
rst.MoveNext
Wend
rst.Close
End Sub
Now run your VB Project (click F5) on your keyboard
Done!!!.