Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Undeclared Variable in Expression Issue

Status
Not open for further replies.

Nassy

Programmer
Mar 27, 2003
121
GB
Hi

I have been experimenting with creating my own Counter variables having read an interesting thread by 'Catadmin'. I am trying to create a counter that will return the Group Number.

So far I declared a Shared Counter variable and have written 3 functions, one that increments the Counter, one that displays the Counter and one that resets it to 0. This code has been added under the Code tab under Report Properties

What the problem is
If I create a simple report with a region (table in this case) grouped on the field CITY I find that if I call the increment function in the group header and the display function in the group header I get a group number for each group. Hurrah!

Unfortunately though, when I try to reference the Counter variable.. lets say in an IIF expression ie

[blue] IIF (Counter = 1, TRUE, FALSE) [/blue] I get a message stating that the variable Counter is undeclared-- even though I have declared it as a shared variable.

How do I get around this? I want to reference the Counter variable so that I can set the visibility of a group row depending on the group number.

Its frustrating as I had thought I was getting to the bottom of this!

Nassy
 
Try:

IIF (Code.Counter = 1, TRUE, FALSE)



Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Thanks Geoff,

Its strange as when I typed in the code the editor didn't like it (had 'Code.Counter' underlined in red, but I ignored this and find that it does actually work when I run the report. Great news.

Thanks again for very quick reply!

Nassy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top