Update Field in table

  • Thread starter Thread starter Nigel
  • Start date Start date
N

Nigel

I have a table query called custinvcountqry based on the number of invoices
each customer has, the qry has 2 fields, countofinv and customerid. what I
am trying to do is update each customer record with the number of invoices
they have in the system, the field name in the customer table is invcount,
what is the most efficient way of doing this, the count will only be updated
when the user exits the program
 
I have a table query called custinvcountqry based on the number of invoices
each customer has, the qry has 2 fields, countofinv and customerid. what I
am trying to do is update each customer record with the number of invoices
they have in the system, the field name in the customer table is invcount,
what is the most efficient way of doing this, the count will only be updated
when the user exits the program

Why?
Why store the count of invoices?
As it is a calculated result, anytime you need to work with that
count, simply calculated it, directly in the control source of an
unbound control... something like this generic code:

=DCount("*","TableName","CustomerID=" & [CustomerID])

The above code assumes that [CustomerID] is a Number datatype.
If, in fact [CustomerID] is Text datatype, then use:

=DCount("*","TableName","CustomerID='" & [CustomerID] & "'")

The count will appear on the form that displays that customer's ID
field.

There is no need to store this value.
 
Back
Top