By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Problem with counting selected records on form

P: n/a
I have a continous form.
That form has three checkboxes, two unbound and one (MyCheckbox1)
bound to MyField.
The whole form is bound to the table tblMyTable which contains the
field MyField.

Whenever one of the two unbound checkboxes are chosen a query is run
on MyTable and the
field(s) MyField will be set to True or False

I want to know how much of the MyFields in MyTable are set to True. In
realtime.

I wrote this code:

Sub CountSelected()
Dim varNumberSelected
DoCmd.Save
varNumberSelected= DCount("MyField", "MyTable", "MyField = True")
Me.txtNumberSelected = varNumberSelected
End Sub

Whenever this code is called is runned from one of the unbound
checkboxes it runs hypersweet but when it is called from the unbound
checkbox it seems to be lagging one behind. I suspect this has to do
with the form being dirty but saving the form on beforehand does not
work, where am I going wrong? Any one can shed some light? Thanks in
advance!

Henro

Mar 9 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.