JoseMarques
Programmer
I've sql database and a access front end.
In a form i'm trying to copy data from 3 distinct recordsets to a commonbox.
I'm using this code to copy the data from one recordset to the common box :
Set iconn = New ADODB.Connection
iconn.ConnectionString = string1
iconn.Open
Set rs = New ADODB.Recordset
str = "SELECT Nome FROM EntidadesGestoras Order By Nome;"
rs.Open str, iconn, adOpenDynamic, adLockOptimistic
With Me.Nome1
For j = .ListCount - 1 To 0 Step -1
.RemoveItem (lListIndex)
Next j
End With
Me.Nome1 = ""
If Not (rs.EOF And rs.BOF) Then
rs.MoveFirst
i = 0
With Me.Nome1
Do While Not rs.EOF
strnome = rs!Nome
.AddItem strnome, Index:=i
i = i + 1
rs.MoveNext
Loop
End With
End If
rs.Close
Set rs = Nothing
iconn.Close
Set iconn = Nothing
I call this function for the 3 distinct recordsets.
Works fine with 32767 characters in the List but when it's more gives a error.
error:
Run time error 6015
combobox: Can't add this item, index is too large
Is there any way to expand the list to more characters?
If not how can I make the copy of the data from the 3 recordsets to the common box?
In a form i'm trying to copy data from 3 distinct recordsets to a commonbox.
I'm using this code to copy the data from one recordset to the common box :
Set iconn = New ADODB.Connection
iconn.ConnectionString = string1
iconn.Open
Set rs = New ADODB.Recordset
str = "SELECT Nome FROM EntidadesGestoras Order By Nome;"
rs.Open str, iconn, adOpenDynamic, adLockOptimistic
With Me.Nome1
For j = .ListCount - 1 To 0 Step -1
.RemoveItem (lListIndex)
Next j
End With
Me.Nome1 = ""
If Not (rs.EOF And rs.BOF) Then
rs.MoveFirst
i = 0
With Me.Nome1
Do While Not rs.EOF
strnome = rs!Nome
.AddItem strnome, Index:=i
i = i + 1
rs.MoveNext
Loop
End With
End If
rs.Close
Set rs = Nothing
iconn.Close
Set iconn = Nothing
I call this function for the 3 distinct recordsets.
Works fine with 32767 characters in the List but when it's more gives a error.
error:
Run time error 6015
combobox: Can't add this item, index is too large
Is there any way to expand the list to more characters?
If not how can I make the copy of the data from the 3 recordsets to the common box?