Calculate post and show number for every post

  • Thread starter Thread starter Highlight between 3 fields
  • Start date Start date
H

Highlight between 3 fields

Hello

I have Form with list post and filter for searching by textbox.
The scour for this form is query.
I want make count number to know how many raw is on this post list and show
with every post a number.
I create a textbox and insert on it this code:

=oppp(IIF(true;1;0))

And create a modul that looks as this:

Option Compare Database
Dim aaa As Integer

Function oppp(sss) As Integer

If sss = 1 Then
aaa = aaa + 1
ElseIf sss = 0 Then
aaa = 0
End If
oppp = aaa

End Function


The problem is number work good then it starts just step increase when I
move the list up & down. Even if I close the form and restart it or update
the form, just larger number.

Where the wrong on this is code or is there better idea to get the counter
on form on MS Access 2007?

Thanks a lot
 
I'm not sure what you are trying to do, but the problem with your code is the
control source of the text box.

You have =oppp(IIF(true;1;0))

This is the same as =oppp(1)


In the IIF() function, the condition TRUE is *ALWAYS* True - it will never
be False - so a zero will not be passed to your function and the global
variable "aaa" will never be set/reset to zero.


HTH
 
Back
Top