David and Joanne Gould
dajomigo at dgsolutions.net.au
Tue Oct 9 19:32:39 CDT 2007
Arthur Thanks for your suggestion. The query works fine. It lists all the choices from a selection made in another combo box but starts with the most popular. When I use the DLookup code it doesn't do anything. The combo dropdown shows all the options as it should but doesn't show anything in the text box until a choice is made. David At 01:26 AM 10/10/2007, you wrote: >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 > > > > > > > > >-- >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com > > >-- >No virus found in this incoming message. >Checked by AVG Free Edition. >Version: 7.5.488 / Virus Database: 269.14.5/1058 - Release Date: >8/10/2007 4:54 PM