dcount() query

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
 
C

Clifford Bass

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
 

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