Update Field in table

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
 
F

fredg

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top