# Question on a calc for Privileges (browse records)

This topic is 7864 days old. Please don't post here. Open a new topic instead.

## Recommended Posts

I was playing with some calcs for the Browse Records section of Privleges. Something like this for comparing one field to another seems to work:

If(gGroup 1 = Group 1, "1", "")

Or a variation like this works:

gGroup 1 = Group 1

But when I try to do multiples like the following it does not work.

If(gGroup 1 = Group 1, "1", "") or

If(gGroup 2 = Group 2, "1", "") or

If(gGroup 3 = Group 3, "1", "") or

If(gGroup 4 = Group 4, "1", "")

Any tricks to get this to work? I tried replacing the "or" with "&", but of course that will not work because then all four would have to match for the calc to work. I am trying to set it up so that if any one of the four match up that "Browse Records" is available.

LR

##### Share on other sites

The syntax is wrong. The case statement is easier than if's

Case(

gGroup1 = Group 1, 1,

gGroup2 = Group 2, 1,

gGroup3 = Group 3, 1

gGroup4 = Group 4, 1,"")

##### Share on other sites

That'll work. however, since the tests themselves produce boolean results, you could dispense with the function altogether and simply use:

gGroup1 = Group 1 or gGroup2 = Group 2 or gGroup3 = Group 3 or gGroup4 = Group 4

That will produce a 1 if any of the tests are true, and a zero if all of them fail.

##### Share on other sites

gGroup1 = Group 1 or gGroup2 = Group 2 or gGroup3 = Group 3 or gGroup4 = Group 4

AAAGGGHHH

I had already tried that one, but it does not work right...although I would think it should.

gGroup1 = Group 1 by itself works.

gGroup1 = Group 1 or gGroup2 = Group 2 or gGroup3 = Group 3 or gGroup4 = Group 4 ends up allowing browse privleges to all records. Yet I can go to a one of the records and clearly see that none of the four fields in the above calc match, so logically the record should not be able to be seen.

Even more perplexing:

gGroup1 = Group 1 or gGroup2 = Group 2

Allows me to view all the records where gGroup = Group 1, but I can't see any of the records where gGroup2 = Group 2, although there are records where this is the case.

LR

##### Share on other sites

Double check that your global fields are actually defined as globals and not text or number fields.

##### Share on other sites

Bob's point is very valid. Good one.

Also check that the data type specified for the pairs of fields matches. If you are trying to match up a global number field with a text field - or vice versa, that will cause the tests to behave in a way which appears erratic.

##### Share on other sites

Oh praise be...

That was what seemed to be the problem. I had one of the fields that was not set correctly as a global. That seemed to clear it up.

Just a quick question...since I have not used access privleges for browse records before. It seems that by doing so, this REALLY slows down the database when opening. I assume this is because when opening the file it is doing a search of all the records to find a match for gGroup1 = Group 1 or gGroup2 = Group 2. Is this slowness just the nature of the beast? Right now I only have about 250 records, what happens when it grows to 2000 records?

LR

##### Share on other sites

This topic is 7864 days old. Please don't post here. Open a new topic instead.

## Create an account

Register a new account