hi i want to retrieve data from access through vb6.0 program but its not working.
either sort out my error or help me with correct coding.
thanks in advance !!!!!!!
mail me at himanshu_s27@rediffmail.com
my coding:
Private Sub Command5_Click()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\raghu project\dt.mdb;Persist Security Info=False"
If cn.State = adStateOpen Then
cn.Close
End If
cn.Open
rs.Open "select * from Table1 ", cn, adOpenStatic
While rs.BOF = False
If rs.State = adStateOpen Then
rs.Close
End If
On Error GoTo error2
rs.Open "select * from Table1 where Location=" & Val(Combo1.Text) & " and F_Time = " & Val(Text1.Text) & " and To_Time = " & Val(Text2.Text) & "" , cn, adOpenStatic
Exit Sub
error2:
MsgBox Err.Description
Exit Sub
rs.MoveNext
Wend
cn.Close
Set cn = Nothing
End Sub