Martin Reid
mwp.reid at qub.ac.uk
Fri Aug 15 00:05:38 CDT 2003
There is a work around the string length problem. WIll have a look for the
example
Martin
----- Original Message -----
From: "David McAfee" <DMcAfee at haascnc.com>
To: "'Access Developers discussion and problem solving'"
<accessd at databaseadvisors.com>
Sent: Thursday, August 14, 2003 1:55 PM
Subject: RE: [AccessD] Setting A2K combo box rowsource using ADO - SOLVED
> The value list will work but has a few caveats.
>
> 1. Any semi-colons or commas in your data will mess up your columns (make
> sure you strip them out prior to filling list box)
> 2. There is a smaller size limit, so if you are expecting to have a lot of
> data in your combo box (hidden columns) then you will be limited.
>
>
> David
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Martin Reid
> Sent: Thursday, August 14, 2003 7:47 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Setting A2K combo box rowsource using ADO -
> SOLVED
>
>
> Try Rowsource instead of Recordset
>
> This is an example I got somewhere
>
> if g_oConnection = OpenConenction then
> Dim oRes As ADODB.Recordset
> Dim sListText As String
>
> Set oRes = New ADODB.Recordset
>
> Me.cboMyList.ColumnCount = 2
> Me.cboMyList.BoundColumn = 1
> Me.cboMyList.ColumnHeads = False
> Me.cboMyList.ColumnWidths = "0;1"
> Me.cboMyList.RowSourceType = "Value List"
> Me.cboMyList.DefaultValue = 0
>
> oRes.Open "select * from tbMyTable order by label", g_oConnection,
> adOpenDynamic, adLockOptimistic
>
> sListText = "0;'<Anything>';"
> While oRes.EOF = False
> sListText = sListText & oRes("ID").Value & ";" &
> oRes("Label").Value & ";"
> oRes.MoveNext
> Wend
> oRes.Close
> Me.cboMyList.RowSource = sListText
>
> Set oRes = Nothing
> CloseConnection
> end if
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>