[AccessD] Combo box default value

Arthur Fuller fuller.artful at gmail.com
Tue Oct 9 10:26:43 CDT 2007


Oops. I clicked "Send" too quickly. In the Dlookup you refer to the named
query not the table. In my case  the combo box's  default  value is:

=DLookUp("CompanyID","CompanyCount_Desc_qs")

(The _qs is my naming convention, denoting a query select. _qu is a query
update, _qd is a delete, etc.)

A.

On 10/9/07, Arthur Fuller <fuller.artful at gmail.com> wrote:
>
> You could count the actual entries in the table (not in the lookup table)
> and select top 1 descending: Here's an example drawn from one of my apps.
>
> SELECT TOP 1 LightCurtainData_tbl.CompanyID, Count([CompanyID]) AS
> Occurrences
> FROM LightCurtainData_tbl
> GROUP BY CompanyID
> Order By Count([CompanyID]) DESC
>
> Edit to suit, save as a named query. Use Dlookup() to obtain the value.
> Make the default value of the combo "=Dlookup("[CompanyID]",
> "LightCurtainData_tbl") in this case. Substitute your own values for the
> table and columns and you're away to the races. I just whipped up a sample
> form to test it and it works as advertised.
>
> hth,
> Arthur
>
> On 10/9/07, David and Joanne Gould <dajomigo at dgsolutions.net.au> wrote:
> >
> > Steve
> >
> > The combo box is based on a query that lists departure points for a
> > tour bus based on the postcode of the client. It lists the options by
> > most popular to least popular. At the moment it starts off with a
> > blank text box and I want it to show the most popular as a default.
> > The combo works fine as far as listing the options in the right order
> > - just leaves it blank until a choice is made.
> >
> > Hope this makes more sense.
> >
> > David
> >
> >
>



More information about the AccessD mailing list