[AccessD] combo box 101

Darrell Burns dhb at flsi.com
Tue Aug 9 19:06:28 CDT 2011


Amen, brother. I do the same thing...bind my comboboxes to named queries. If
the list requires some pre-processing, I'll either bind the cbo to a temp
table which I fill on focus, or fill it in code with ctl.rowsource = sqlStr
(make sure Row Source Type is set to 'value list').  But I NEVER build
RowSources with SELECT statements or with references to form controls.
B-b-b-b-b-bad!

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller
Sent: Monday, August 08, 2011 5:28 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] combo box 101

I don't want to get argumentative here; I hoping that the agreed purpose is
discussion and exchange of information. But I have to say, I hate this kind
of code, and every time I'm called in to do a job on some previous version,
pretty much the second thing I do is search for any rowsources that begin
with the word "SELECT", then open them and then save them to named queries I
also hate the citation of a specific form and field on said form, because
that renders the code strictly local, when in actuality you might to re-use
that query in several places (other forms or subforms, other queries,
various reports, etc.)

So my initial suggestion would be to replace the SELECT statement with a
named query, and instead of using a reference to a specific form create some
static functions that return the desired value(s) whether or not the form is
open. That frees you up to set the static values and then run the queries
from the immediate window, so you can debug them effectively.

The previous responses have also included good ideas about column width and
column count.

HTH,
Arthur

On Mon, Aug 8, 2011 at 5:42 PM, Bob Gajewski
<rbgajewski at roadrunner.com>wrote:

> Sounds obvious, but check the column count ... Even if you have the 
> widths set for multiple columns (0",0",2") and the bound column set 
> (0), if your column count is set to 1 then that's all you get!
>
> Bob Gajewski
>
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list