469,086 Members | 1,216 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,086 developers. It's quick & easy.

Problem with counting selected records on form

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

I wrote this code:

Sub CountSelected()
Dim varNumberSelected
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


Mar 9 '07 #1
0 1031

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Mike N. | last post: by
2 posts views Thread by swethak | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by kglaser89 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.