WeeBeng
April 27th, 2001, 01:12 AM
I have this data base which I am trying to access throught Data Access object ,DAO. I wrote the following code to select a part of the database.
[vbcode]
Private Sub Form_Load()
Dim db As DAO.Database
Dim ws As DAO.Workspace
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(App.Path & "\signals.mdb")
Dim rstbl As Recordset
Dim sql1 As String
Dim now As String
now = "11:27:35 AM"
sql1 = "SELECT [Date],[Time],[Mean_Power],[Time_of_Entry] FROM [Signal] Where [Time_of_Entry]=now "
Set rstbl = db.OpenRecordset(sql1, dbOpenDynaset)
End Sub
However I found the the recordset.recordcount to be zero. Using MSaccess, I designed the following query which does what I want and gives me a database with data.
SELECT Signal.Time_of_Entry, Signal.Date, Signal.Time, Signal.Min_Power
FROM Signal
WHERE (((Signal.Time_of_Entry)="11:27:35 AM"));
How should I code this query inside VB so that it performs the same function as the above query?
Is there also a simple way to insert all the data in the recordset into a MSFlexGrid?
Thanx
[vbcode]
Private Sub Form_Load()
Dim db As DAO.Database
Dim ws As DAO.Workspace
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(App.Path & "\signals.mdb")
Dim rstbl As Recordset
Dim sql1 As String
Dim now As String
now = "11:27:35 AM"
sql1 = "SELECT [Date],[Time],[Mean_Power],[Time_of_Entry] FROM [Signal] Where [Time_of_Entry]=now "
Set rstbl = db.OpenRecordset(sql1, dbOpenDynaset)
End Sub
However I found the the recordset.recordcount to be zero. Using MSaccess, I designed the following query which does what I want and gives me a database with data.
SELECT Signal.Time_of_Entry, Signal.Date, Signal.Time, Signal.Min_Power
FROM Signal
WHERE (((Signal.Time_of_Entry)="11:27:35 AM"));
How should I code this query inside VB so that it performs the same function as the above query?
Is there also a simple way to insert all the data in the recordset into a MSFlexGrid?
Thanx