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.
 
Where is the Current event of the form?
Is that in the coding area?
Thank you,
 
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.
 

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

Back
Top