Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

about combobox in VB 1

Status
Not open for further replies.

1751983

Programmer
Jan 21, 2003
3
0
0
PK
HI
i am new in VB programming.
i made data base in MS Access 2000 and i use ADO to connect the database.
i want to use combobox but my combobox shows only 1 value not all and also give error of unrecognized datadbase.
i use this code for show values in combobox.
Set Rs = Db.OpenRecordset("source")
'Rs.MoveFirst
'Do Until Rs.EOF
'comsource.AddItem Rs.Fields("sourcename")
'Rs.MoveNext
'Loop
'Db.Close

but it is not working.
another problem is that.
i want connect 1 combobox with my 1 database table (source)field and another combobox with other table destination (field).
means i select 1 item from 1 combo box and another from another combobox then press the button so it will show the result which is stored in my third database table (result).
i want help in code.
plz reply soon



 
One option could be instead of using a combobox use a datacombo instead (you will need to set up the connection option)

In Project - > components make sure
Microsoft ADO Data COntrol... and Microsft Datalist Control


Other choice is to do this

Set objConn = New ADODB.Connection
objConn.Open "Provider = Microsoft.jet.OLEDB.3.51;Data Source = drive:\path\database.ext"

Set objRec = New ADODB.Recordset
objRec.Open sqlAction, objConn
Do While (Not objRec.EOF = True)
combobox.additem(objrec.fields("row name"))
objrec.movenext
Loop
Set objRec = Nothing
Set objConn = Nothing

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top