ListCount or RecordCount

  • Thread starter Thread starter Rob
  • Start date Start date
R

Rob

Hi all,

I have two list boxes that list tasks that an employee has completed, and
tasks that the employee is yet to complete. When a task is completed I
requery both list boxes and redisplay the results. I then calculate a
percentage complete based on the ListCount of each box (with an Iif to
account for zero records in a list box).

Is this an acceptable method for calculating the percentage or should I be
opening a recordset based on the query and using RecordCount instead. I was
using the ListCount property rather than a recordset as I did not want to
rerun a query for information that was already available to me.

Unfortunately it doesn't seem that elegant or safe! Is there a better way of
conducting this task? It is not a serious issue but as I am still learning
Access (Acc97 by the way - restricted to works version) I am hoping to have
ptimised and "correct" code from the outset,

Cheers
Rob
 
Rob said:
I have two list boxes that list tasks that an employee has completed, and
tasks that the employee is yet to complete. When a task is completed I
requery both list boxes and redisplay the results. I then calculate a
percentage complete based on the ListCount of each box (with an Iif to
account for zero records in a list box).

Is this an acceptable method for calculating the percentage or should I be
opening a recordset based on the query and using RecordCount instead. I was
using the ListCount property rather than a recordset as I did not want to
rerun a query for information that was already available to me.

Unfortunately it doesn't seem that elegant or safe! Is there a better way of
conducting this task? It is not a serious issue but as I am still learning
Access (Acc97 by the way - restricted to works version) I am hoping to have
ptimised and "correct" code from the outset,


ListCount is a good way to do that, for the reason you
stated.

I don't think there is anything "unsafe" about it and its a
lot more "elegant" than mucking about with recordsets when
the desired value is already known.
 
Thanks for your response Marsh. In other forms of visual coding I have done
(read here taught but never implemented professionally :) I tried to use
properties of the object being displayed rather than the control used to
display it although this may have been a fall back from Uni days.

Cheers
Rob
 
Back
Top