Show all records in query if conditions is false

G

Guest

I have a query that I want to show the records only created by the person who
is currently logged in. However, I have two specific log-in names that I
want to allow to view all records in the query without restriction. Here is
my IIF:

iif(currentuser()<>"btibbs" or "csarmiento",currentuser())

So if your name is not btibbs or csarmiento, you only see records that you
created, but I want ALL to show if btibbs or csarmiento are logged in.

Thanks
 
D

Duane Hookom

IIf() takes three arguements and you have provided two. Also, you must use
iif(currentuser()<>"btibbs" or
currentuser()<>"csarmiento",currentuser(),[UserFieldName])
or
iif(currentuser() IN ("btibbs","csarmiento"),currentuser(),[UserFieldName])
 
G

Guest

The name of the field that I store the user name in when the record is
created is called [projectcreator]. Below is the equation that you showed me:

iif(currentuser()<>"btibbs" Or
currentuser()<>"csarmiento",currentuser(),[projectcreator])

But logged in as btibbs, I still just get the records for btibbs. If I am
btibbs or csarmiento, I want all of the records, otherwise, I just want the
records of the person logged in. What am I missing?

Thanks for your help! - Brian

Duane Hookom said:
IIf() takes three arguements and you have provided two. Also, you must use
iif(currentuser()<>"btibbs" or
currentuser()<>"csarmiento",currentuser(),[UserFieldName])
or
iif(currentuser() IN ("btibbs","csarmiento"),currentuser(),[UserFieldName])
--
Duane Hookom
MS Access MVP


BLTibbs said:
I have a query that I want to show the records only created by the person
who
is currently logged in. However, I have two specific log-in names that I
want to allow to view all records in the query without restriction. Here
is
my IIF:

iif(currentuser()<>"btibbs" or "csarmiento",currentuser())

So if your name is not btibbs or csarmiento, you only see records that you
created, but I want ALL to show if btibbs or csarmiento are logged in.

Thanks
 
J

John Spencer (MVP)

Pardon me for butting in.

Field: ProjectCreator
Criteria: LIKE IIF(CurrentUser() in ("btibbs","csarmiento"),"*",CurrentUser)
The name of the field that I store the user name in when the record is
created is called [projectcreator]. Below is the equation that you showed me:

iif(currentuser()<>"btibbs" Or
currentuser()<>"csarmiento",currentuser(),[projectcreator])

But logged in as btibbs, I still just get the records for btibbs. If I am
btibbs or csarmiento, I want all of the records, otherwise, I just want the
records of the person logged in. What am I missing?

Thanks for your help! - Brian

Duane Hookom said:
IIf() takes three arguements and you have provided two. Also, you must use
iif(currentuser()<>"btibbs" or
currentuser()<>"csarmiento",currentuser(),[UserFieldName])
or
iif(currentuser() IN ("btibbs","csarmiento"),currentuser(),[UserFieldName])
--
Duane Hookom
MS Access MVP


BLTibbs said:
I have a query that I want to show the records only created by the person
who
is currently logged in. However, I have two specific log-in names that I
want to allow to view all records in the query without restriction. Here
is
my IIF:

iif(currentuser()<>"btibbs" or "csarmiento",currentuser())

So if your name is not btibbs or csarmiento, you only see records that you
created, but I want ALL to show if btibbs or csarmiento are logged in.

Thanks
 
G

Guest

Thanks John Spenser!! That works! Butt in any time...

John Spencer (MVP) said:
Pardon me for butting in.

Field: ProjectCreator
Criteria: LIKE IIF(CurrentUser() in ("btibbs","csarmiento"),"*",CurrentUser)
The name of the field that I store the user name in when the record is
created is called [projectcreator]. Below is the equation that you showed me:

iif(currentuser()<>"btibbs" Or
currentuser()<>"csarmiento",currentuser(),[projectcreator])

But logged in as btibbs, I still just get the records for btibbs. If I am
btibbs or csarmiento, I want all of the records, otherwise, I just want the
records of the person logged in. What am I missing?

Thanks for your help! - Brian

Duane Hookom said:
IIf() takes three arguements and you have provided two. Also, you must use
iif(currentuser()<>"btibbs" or
currentuser()<>"csarmiento",currentuser(),[UserFieldName])
or
iif(currentuser() IN ("btibbs","csarmiento"),currentuser(),[UserFieldName])
--
Duane Hookom
MS Access MVP


I have a query that I want to show the records only created by the person
who
is currently logged in. However, I have two specific log-in names that I
want to allow to view all records in the query without restriction. Here
is
my IIF:

iif(currentuser()<>"btibbs" or "csarmiento",currentuser())

So if your name is not btibbs or csarmiento, you only see records that you
created, but I want ALL to show if btibbs or csarmiento are logged in.

Thanks
 
P

peregenem

John said:
Field: ProjectCreator
Criteria: LIKE IIF(CurrentUser() in ("btibbs","csarmiento"),"*",CurrentUser)

Alternatively (in SQL code):

ProjectCreator = IIF(CurrentUser() IN ('btibbs', 'csarmiento'),
ProjectCreator ,CurrentUser)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top