View Single Post
  #7  
Old April 26th, 2010, 04:17 PM posted to microsoft.public.access
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Faster DCount or Query

I vote with John's solution. A combobox takes up less room on the screen,
and does NOT require the user to scroll through a list of up to 200 items.

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"PeterM" wrote in message
...


"Jeff Boyce" wrote:

Peter

Remember that forms (and listboxes) are only displaying what Access is
storing underneath in tables.

When you give us "SELECT Count(*) FROM Medication", we have to assume
that
"Medication" is the name of a table. Is that correct?


yes, Medication is a table


So why are you using DCount() or a listbox or ... to count the number of
rows in a table? What business need are you trying to satisfy with that
number?


I have a listbox on the Medication Maintenance form listing all entries in
the Medication table so that users can click on an entry in the listbox
and
go directly to that entry rather than nextrecord or previousrecord actions
or
a search function. It's strictly a navigation tool. I use this method
for
all maintenance forms where tables can have 100 - 200 records in it. This
way the user can scroll up or down to find the entry in the listbox, click
on
that entry and the maintenance form populates with the info for that
Medication so the user can edit it. I use the dcount value in the label
of
the listbox to show:

me.MedicationListboxLabel = DCount("*","Medication") & " Total Entries"


More info, please...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"PeterM" wrote in message
...
I have a listbox on a form in AC2003 that counts the total number of
entries
in a table.

Select count(*) from Medication

I execute the requery of the listbox after each record save.

My question is, is it faster/more efficient to continue using the
listbox
or
simply do a DCount?

Thanks in advance.



.