Hello, I have been working at this for days and am no better off. I could really use some help.
I need to populate a combobox with data from a column in an SQL table. I have put together the code below but am having an error at this line:
invBegNum.additem rs.Fields.Item("RMDNUMWK").Value
Error message:
"Object doesn't support this property or method"
I'm really a newb but am trying hard to get this. Here is the code. Please help.
visual basic code
Sub getInvData()
Dim conn As ADODB.Connection
Dim connString As String
conString = "Provider=sqloledb;Data Source=localhost;Initial Catalog=BBTN;User Id=scott;Password=bigdaddy"
Set conn = New ADODB.Connection
conn.ConnectionString = connString
conn.Open connString
Dim rs As ADODB.RecordSet
Dim sSQL As String
Set rs = New ADODB.RecordSet
sSQL = "select RMDNUMWK from SV00564 order by RMDNUMWK"
rs.Open sSQL, conn
Do Until rs.EOF
invBegNum.additem rs.Fields.Item("RMDNUMWK").Value
rs.MoveNext
Loop
rs.Close
conn.Close
Set conn = Nothing
Set rs = Nothing
End Sub
I need to populate a combobox with data from a column in an SQL table. I have put together the code below but am having an error at this line:
invBegNum.additem rs.Fields.Item("RMDNUMWK").Value
Error message:
"Object doesn't support this property or method"
I'm really a newb but am trying hard to get this. Here is the code. Please help.
visual basic code
Sub getInvData()
Dim conn As ADODB.Connection
Dim connString As String
conString = "Provider=sqloledb;Data Source=localhost;Initial Catalog=BBTN;User Id=scott;Password=bigdaddy"
Set conn = New ADODB.Connection
conn.ConnectionString = connString
conn.Open connString
Dim rs As ADODB.RecordSet
Dim sSQL As String
Set rs = New ADODB.RecordSet
sSQL = "select RMDNUMWK from SV00564 order by RMDNUMWK"
rs.Open sSQL, conn
Do Until rs.EOF
invBegNum.additem rs.Fields.Item("RMDNUMWK").Value
rs.MoveNext
Loop
rs.Close
conn.Close
Set conn = Nothing
Set rs = Nothing
End Sub