VB6 Recordset (1 Viewer)

epicmove

Ben
Local time
Today, 08:21
Joined
Apr 21, 2006
Messages
59
Hi guys,

I am currently trying to fix a VB6 application. One of the main issues is that log data was being written to text files rather than the database.

I am therefore changing the application to write these log entries to the existing access db.

Unfortunately, as I am more used to .net programming (e.g. ado.net) I am having problems trying to get the log data back out of the database. The existing programmer used DAO and typed recordsets so I am not sure how I can then query these using SQL

For example:

Code:
Set db = OpenDatabase(App.Path & "mydatabase.mdb")
Set rs = db.OpenRecordSet("mytable")

'populate list box with data items"
rs.Movefirst
While Not rs.EOF
    ListBox1.AddItem rs("Field1") & " : " & rs(Field2)
    rs.MoveNext
Wend

My problem is that i need to pull out the data for a specific date i.e.
Code:
"select * from mytable where field1 =" & Now()

Sure I could create another dataset to accomplish this, but is there a way to use the existing one? I tried using the recordset.filter property but this failed to work, plus I dont want to extract all the data then filter it.

Unfortunately as the main parts of the db are still using DAO I cant really change it to ADO.

Any help would be much appreciated.

Ben
 

DrSnuggles

Well the hell is Hudson??
Local time
Today, 08:21
Joined
Sep 14, 2004
Messages
117
Why not try something like this:

While Not rs.EOF
if rs("Field1") = Now() then
'Do Something
endif
rs.MoveNext
Wend
 

Users who are viewing this thread

Top Bottom