whts wrong with the sql statement [resolved]
i have a code from some source that display data from database to the flexgrid.
the prob is i want the data to be displayed depend on the selected date.
so i just put the sql statement which i think (may be the sql statement is wrong..) will display data according to the date.
and, an error ocurred whis is datatype mismatch and it points to the sql statement. why is that so??
VB Code:
Private Sub Command4_Click()
On Error GoTo errHandler
Set Conn = GetConnection
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM pemeriksaanBM WHERE tarikh = '" & DTPicker1.Value & "'", Conn, adOpenStatic, adLockOptimistic
'rs.Open "SELECT * FROM pemeriksaanBM ", Conn, adOpenStatic, adLockOptimistic
With rs
If Not .EOF Then
FG_ShowRecordset MSFlexGrid2, rs
End If
.Close
End With
Conn.Close
Set Conn = Nothing
Set rs = Nothing
Exit Sub
errHandler:
MsgBox "An error occured." & vbLf & Err.Number & ": " & Err.Description, vbCritical
Set Conn = Nothing
Set rs = Nothing
End Sub