how to filter data using SQL and evb - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


how to filter data using SQL and evb

Hi, i would like to select records from the Pocket Access database with the date of current day. Let say that today is 23-9-2003, it will shows all the records that has the date of 23-9-2003. then then next day, it will show all the records with the date of 24-9-2003. below is the code that i wrote but can't work. it gives me the error message An error was encountered while running this program: A literal value in the command could not be converted to the correct type due to a reason other than data overflow. What it means? Please help. A million thanks.

Dim RS As ADOCE.Recordset
Dim SQL As String
Dim i As Integer
Dim dd As Date

Set RS = CreateObject("ADOCE.Recordset.3.1")

SQL = "SELECT * FROM Blood_Tracking WHERE Date = " & dd & "" 'Create SELECT statement to return all fields
RS.Open SQL, "My Documentsdiabetes.cdb"

For i = 1 To gd.Rows 'Remove existing data from Grid
gd.RemoveItem 0

gd.AddItem "Date" & vbTab & _
"Time" & vbTab & _
"Mg/dL" & vbTab & _
"Shortinsulin" & vbTab & _
"Longinsulin" & vbTab & _

While Not RS.EOF
gd.AddItem RS("Date") & vbTab & _
RS("Time") & vbTab & _
RS("Mg/dL") & vbTab & _
RS("Shortinsulin") & vbTab & _
RS("Longinsulin") & vbTab & _

Set RS = Nothing
Sign In or Register to comment.