dcount() query

  • Thread starter Thread starter Mark Kubicki
  • Start date Start date
M

Mark Kubicki

I want to display how many unique records for a field have been entered into
the table

The field is [Lamp] which is in the table [FixtureSpec] that is being used
as the data source for the current form.
The value of [Lamp] is being displayed in the textbox [txtLamp]

A query [qryLampList] has been setup which used the field [Lamp] of the
table [FixtureSpec] as it data and has its property set to unique values

On the current form is a textbox [txtLampCount], that has the formula
=DCount("Lamp","qryLampList") as its control source

Behind [txtLamp].on change event, I have the code: txtLampCount.requery

the field does not always update; what am I doing wrong that it does not
update as soon as the value of [Lamp] changes?

thank in advance,
Mark
 
Hi Mark,

It is probably only counting the data that is already saved. When it
is changed in the text box, that change is in the form only, not in the
table. So, if it does not cause a problem you could save the record prior to
doing the count. If not, you might do a count that excludes the current
record and then adds 1 for the current unsaved value.

Clifford Bass
 
Back
Top