Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DCount with Distinct or Remote DB

Status
Not open for further replies.

dpimental

Programmer
Jul 23, 2002
535
US
Is there a way to do a dcount on a distinct list of values?

In other words, I have a field called filename. I want to take the distinct list of file names and count them.

Also, can dcount be used with tables in another database.

From currentdb, I want to do a dcount in database2, table1, for fielda.

David Pimental
(US, Oh)
 
If you want to display this data in a Form it'd be easier to use:
SELECT currentdbTable.filename, Count(currentdbTable.filename) AS Count
FROM currentdbTable
GROUP BY currentdbTable.filename;

as the RecordSource. You could also set this as a RowSource for a ListBox, or ComboBox

If you want to the values in code, use it as Recordset Source and Loop through the records or use the Find method.

Create a linked Table based on database2 table1 and you can use the same arguments on remote data.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top