Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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
Next

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

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

Set RS = Nothing
Sign In or Register to comment.