AboutRavindra Expertise visual basic application programming from design to access information, sql, engineering and commercial applications. access databases, excel.
Optional:
1)a large number of people want me to do work which takes some time and effort. Pl.note that i would like to be paid for such work.
2) if you want me to spend quality time and do special work, i expect to be paid a reasonable price for my time.
3) if you are pleased with my reply you could consider a donation of 1$.
4) you can visit my website http://ravindra.coolpage.biz (under constrn)
Experience
Past/Present clients project work for a Norway company, and a Canadian company completed. Freelance Project work and Teaching
teaching vb
Question hello sir!please tell me how to connect a db other than biblio and nwind.mdb..i am using vb 6.0 as a beginner..b'coz i am getting an error:unrecognized database format while connecting a db created in ms access..
Answer this error is because of version of access if you are using data control.
use this code:
better to have the runners nos in a combobox rather than a textbox.
'put a check mark on Project_references_Microsoft ActiveX Dataobjects library
Option Explicit
Dim cn As ADODB.Connection, rec As ADODB.Recordset
Private Sub Form_Load()
Set cn = New ADODB.Connection
Set rec = New ADODB.Recordset
cn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\ravindra\My Documents\Test_1.mdb;Persist Security Info=False")
rec.Open ("select item from testable"), cn, adOpenStatic, adLockReadOnly
'change to your table name and path
Do While Not rec.EOF
Combo1.AddItem rec.Fields(0)
rec.MoveNext
Loop
rec.Close
End Sub
Private Sub combo1_Click()
Dim esql As String
esql = "select * from testable where RunnerNo=" & "'" & Combo1 & "'"
'the above code is if RunnerNo is a string
if it is an integer
then
esql=select * from testable where RunnerNo=" & val(combo1)
rec.Open (esql), cn, adOpenStatic, adLockReadOnly
label1=rec.fields(0)
label2-rec.fields(1)
'..and so on for all fields in the table
rec.Close
End Sub
Private Sub Form_Unload(Cancel As Integer)
cn.Close
Set cn = Nothing
End Sub