Hi,
I'm simply trying to show the user the number of records he has checked on his form.
I thought I'd use AfterUpdate on the checkbox, but it seems that the recordset that I get is not up to date with the checkbox that triggered the event (afterupdate)... and I don't understand why?
I have to call a ShowAllRecords or Requery to have the exact number of records with the checkbox checked (=-1) but doing so, my form is repainted, and the user is taken at the top of the list (which is unfortunate!)
My code looks like :
'tbl_mandats' is the data source for this form...
Why am I always missing the current record in my query? If I have 3 checkbox checked, it shows 2 until I requery...
And ultimately, how do I get to show the user how many checkbox are checked (again, without going through the requery)?
I'm still using Access 2002, sp3.
Thanks in advance
I'm simply trying to show the user the number of records he has checked on his form.
I thought I'd use AfterUpdate on the checkbox, but it seems that the recordset that I get is not up to date with the checkbox that triggered the event (afterupdate)... and I don't understand why?
I have to call a ShowAllRecords or Requery to have the exact number of records with the checkbox checked (=-1) but doing so, my form is repainted, and the user is taken at the top of the list (which is unfortunate!)
My code looks like :
Code:
Dim rs_nb
Set rs_nb = CurrentDb.OpenRecordset("SELECT count(Num_Mdat) as nb FROM tbl_mandats WHERE b_chk = -1;")
If rs_nb.nb = 0 Then
Form_frm_mdat.btn_term.Enabled = False
Form_frm_mdat.txt_nb.Visible = False
Else
Form_frm_mdat.btn_term.Enabled = True
Form_frm_mdat.txt_nb.Visible = True
Form_frm_mdat.txt_nb.Value = rs_nb.nb & IIf(rs_nb.nb = 1, " mandat", " mandats")
End If
Why am I always missing the current record in my query? If I have 3 checkbox checked, it shows 2 until I requery...
And ultimately, how do I get to show the user how many checkbox are checked (again, without going through the requery)?
I'm still using Access 2002, sp3.
Thanks in advance