Hide Some Combo Values Per Criteria (1 Viewer)

xyba

Registered User.
Local time
Today, 17:20
Joined
Jan 28, 2016
Messages
189
I'm not sure if this is going to be possible but can someone please give me some guidance.

My db has user access and hides some controls dependent on user permissions.

I have a combo box that lists reports available. However, some of these are for administrator only. What I want to do, is hide the admin reports if a standard user logs in.

Is this possible and how can I go about it?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:20
Joined
Oct 29, 2018
Messages
21,468
Hi. You would simply add a critera in the query source of your combobox.
 

xyba

Registered User.
Local time
Today, 17:20
Joined
Jan 28, 2016
Messages
189
Hi. You would simply add a critera in the query source of your combobox.

I simply have the below in the Row Source of the combo box so not sure where I would add criteria. Is it better to create a query instead?

Code:
SELECT [tblReports].[ReportName] FROM tblReports;
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:20
Joined
Oct 29, 2018
Messages
21,468
I simply have the below in the Row Source of the combo box so not sure where I would add criteria. Is it better to create a query instead?

Code:
SELECT [tblReports].[ReportName] FROM tblReports;

Hi. If the reports table has a field to indicate admin use, then you could try something like.
Code:
SELECT ReportName FROM tblReports WHERE AdminOnly=False
 

xyba

Registered User.
Local time
Today, 17:20
Joined
Jan 28, 2016
Messages
189
Hi. If the reports table has a field to indicate admin use, then you could try something like.
Code:
SELECT ReportName FROM tblReports WHERE AdminOnly=False

That hides the admin only reports from the admins though?
 

Gasman

Enthusiastic Amateur
Local time
Today, 17:20
Joined
Sep 21, 2011
Messages
14,270
That hides the admin only reports from the admins though?

It is an example?

You need a way of identifying what reports may be used by what users.?

You could assign a level to each type of user and then compare against the level assigned to the report.

Regardless you need to compare against something, even if you just prefix the report name with Admin and then ignore those for non admin users by inspecting the first 5 characters of the name.?
 

xyba

Registered User.
Local time
Today, 17:20
Joined
Jan 28, 2016
Messages
189
I've managed to sort this by using theDBGuy's example.

But I had to create a query from my table then added the below code and referenced that value. So my query expression was:

Code:
IIf([Expr1]="Admin","Visible",IIf([AdminOnly]=False And [Expr1]="User","Visible","Hidden"))

Then I used this to reference that and it works perfectly

Code:
SELECT ReportName FROM tblReports WHERE Expr1="Visible"
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:20
Joined
Oct 29, 2018
Messages
21,468
I've managed to sort this by using theDBGuy's example.

But I had to create a query from my table then added the below code and referenced that value. So my query expression was:

Code:
IIf([Expr1]="Admin","Visible",IIf([AdminOnly]=False And [Expr1]="User","Visible","Hidden"))
Then I used this to reference that and it works perfectly

Code:
SELECT ReportName FROM tblReports WHERE Expr1="Visible"
Hi. Congratulations! Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom