'Dim cnview As New ADODB.Connection
'Dim rsview As New ADODB.Recordset
'Call Connection(cnview, App.Path & "\additem.mdb", "")
'Call Recordset(rsview, cnview, "SELECT itemno FROM additems")
'With rsview
'While Not .EOF
'Combo1.additem .Fields!agreeitemno.MoveNext
'Wend
'End With
'Set cnview = Nothing
'Set rsview = Nothing
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
'Set con = New ADODB.Connection
'Set rs = New ADODB.Recordset
Set con = DBEngine.OpenDatabase("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=database\additem.mdb;Persist Security Info=False")
Set rs = con.OpenRecordset("additems ")
'Set conn = DBEngine.OpenDatabase(App.Path & "\additem.mdb")
'Set rs = conn.OpenRecordset("additems")
If rs.RecordCount > 0 Then
Do While Not rs.EOF
With Combo1
.additem rs.Fields("itemno")
End With
rs.MoveNext
Loop
End If
2 Replies - 565 Views - Last Post: 19 March 2012 - 11:37 AM
#1
I dunno what to do how to get ms access values in combobox in vb6.0?
Posted 16 March 2012 - 11:48 PM
Replies To: I dunno what to do how to get ms access values in combobox in vb6.0?
#2
Re: I dunno what to do how to get ms access values in combobox in vb6.0?
Posted 17 March 2012 - 12:01 AM
Please can you edit your post and put the code in the [ CODE] tags as it makes it much easier to read.
Can you tell us what the program does/doesn't do at the moment?
Is the DB part working OK, I would suspect not, as you have some of the variables commented out that you're trying to use, so I suspect you get an error?
Have a look at this link on Access DB connectivity using ADO. It's quite indepth and covers both DAO, ADO Controls and ADO programming.
Can you tell us what the program does/doesn't do at the moment?
Is the DB part working OK, I would suspect not, as you have some of the variables commented out that you're trying to use, so I suspect you get an error?
Have a look at this link on Access DB connectivity using ADO. It's quite indepth and covers both DAO, ADO Controls and ADO programming.
#3
Re: I dunno what to do how to get ms access values in combobox in vb6.0?
Posted 19 March 2012 - 11:37 AM
Given that ADODB doesn't have an OpenRecordset method, I'd say your suspicion is a valid one, maj. vasanth, you have mixed up DAO and ADO stuff. It's a common problem. They aren't interchangeable. I recommend using ADO rather than DAO. Follow the link that maj provides, and you should be able to get sorted pretty quickly.
This post has been edited by BobRodes: 19 March 2012 - 11:40 AM
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|