Jeff Boyce said:
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"