Form not updating automatically using dcount

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using the following in control source of a textbox
=DCount("InitialAssesment","Wounds","InitialAssesment=YES AND
WoundDate=date()")

When I move forward to a NEW record the count is updated correctly.
When I move back 1 record the count is wrong (current count -1)
If I open and close the database the count corrects itself.
If I move forward and back through more records the counts SOMETIMES
corrects itself.

Any ideas?
 
Move your code to the Current event of the form:
Me.txtWoundCount = DCount("InitialAssesment","Wounds","InitialAssesment=YES
AND
WoundDate=date()")

I am assuming this is an unbound text box.
 
In design mode, open the properties dialog for the form, click on the Events
tab, then look for On Current. Select the Code Builder option, and put the
code in there.
 
Back
Top