T
tippy
I am trying to convert an Access 2000 app by keeping my front end
forms, etc and moving my files, writing stored procs, views, etc to a
server with SQL Server 2000. I want to process as much on the server
side as possible so I don't want to use ODBC linked tables or pass-thru
queries using ODBC DSN's. I don't have the option of upgrading to
Access 2002 or higher. I need help!
I cannot figure out how to populate a combo box or list box by using
ADO to access the SQL Server tables on my backend server. I have tried
a couple of things with no success.
I tried the GetString Method but the string value built by the select
statement from the table being read is too large so I get an error when
I try to assign it to the RowSource. Sample code follows:
Dim strsql As String
Dim strFill As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
strsql = "SELECT field1, field2, field3 from table"
rs.Open strsql, gcn, adOpenDynamic, adLockReadOnly, adCmdText
strFill = rs.GetString(adClipString, columndelimeter:=";",
rowdelimeter:=";")
Me.cbo.RowSource = strFill 'Bombs-string too long
Me.cbo= Me.cbo_SubArea.ItemData(0)
Then I tried iterating through the recordset using the AddItem but the
method is not available
Sample code:
Do Until rst.EOF
UserForm1.ComboBox1.AddItem rst!field1 'ERROR here
rstEmployees.MoveNext
Loop
Any suggestions?
Tippy
forms, etc and moving my files, writing stored procs, views, etc to a
server with SQL Server 2000. I want to process as much on the server
side as possible so I don't want to use ODBC linked tables or pass-thru
queries using ODBC DSN's. I don't have the option of upgrading to
Access 2002 or higher. I need help!
I cannot figure out how to populate a combo box or list box by using
ADO to access the SQL Server tables on my backend server. I have tried
a couple of things with no success.
I tried the GetString Method but the string value built by the select
statement from the table being read is too large so I get an error when
I try to assign it to the RowSource. Sample code follows:
Dim strsql As String
Dim strFill As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
strsql = "SELECT field1, field2, field3 from table"
rs.Open strsql, gcn, adOpenDynamic, adLockReadOnly, adCmdText
strFill = rs.GetString(adClipString, columndelimeter:=";",
rowdelimeter:=";")
Me.cbo.RowSource = strFill 'Bombs-string too long
Me.cbo= Me.cbo_SubArea.ItemData(0)
Then I tried iterating through the recordset using the AddItem but the
method is not available
Sample code:
Do Until rst.EOF
UserForm1.ComboBox1.AddItem rst!field1 'ERROR here
rstEmployees.MoveNext
Loop
Any suggestions?
Tippy