Adding Sequential Numbers to a Query

  • Thread starter Thread starter Santi
  • Start date Start date
S

Santi

What’s the correct format to use DCount function in Access? I’m trying to add
sequential numbers to the results on a query that’s based on several tables.
Does anyone know how to do that? In my query under design view I have a table
named “item†which from there I want the field named “No†to be the source to
determine how many records get counted.

Any help is greatly appreciated
 
What’s the correct format to use DCount function in Access? I’m trying to add
sequential numbers to the results on a query that’s based on several tables.
Does anyone know how to do that? In my query under design view I have a table
named “item” which from there I want the field named “No” to be the source to
determine how many records get counted.

Any help is greatly appreciated

I have no clue what the Item table is like or how it determines the count, nor
even what you're counting; but the syntax is pretty straightforward. DCount()
takes three arguments. The first can be just a text string "*" if you want to
count all records, or it can be a fieldname (in which case it will count all
non-NULL values of that field). The second argument is a string containing the
name of a table or query. The third, optional, argument is a text string
containing a valid SQL WHERE clause without the word WHERE, defining which
records in the table should be counted.

For example,

DCount("*", "PeopleTable", "[DOB] < #1/1/1950#")

will count the number of records in PeopleTable for which the DOB field is
prior to that date;

DCount("Zap", "qryAllZaps")

will count the number of records in qryAllZaps for which the field Zap is not
null.
 
Back
Top