Go Back   Access World Forums > Microsoft Access Discussion > Reports

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 07-16-2019, 07:17 AM   #16
SetanPutih
Newly Registered User
 
Join Date: Jun 2019
Posts: 21
Thanks: 14
Thanked 0 Times in 0 Posts
SetanPutih is on a distinguished road
Re: Restricted Employee Access to Reports

Thank you Arnelgp

SetanPutih is offline   Reply With Quote
Old 07-17-2019, 01:59 AM   #17
SetanPutih
Newly Registered User
 
Join Date: Jun 2019
Posts: 21
Thanks: 14
Thanked 0 Times in 0 Posts
SetanPutih is on a distinguished road
Re: Restricted Employee Access to Reports

Hi Arnel,

I took your advice but unfortunately it didn't work.

In the Main Menu (Form 1) I can access the training report with no problems.
If I try to access the Annual Leave report to says "Enter Parameter Value - Employee ID". This also happens when I try to click on the Employee Details (rptEmployeeAccess) I have checked the source in properties and EmployeeID is spelt the same.

Also, when I click on Employee Details (rptEmployeeAccess) it takes me to the Annual Leave Report (rptShowEmployeeAnnualLeave|). I changed the coding but it still doesn't work. Please see coding below..

Private Sub List2_DblClick(Cancel As Integer)

Select Case Me.List2.Value

Case "Training"
DoCmd.OpenReport reportname:="Training", WhereCondition:="[Employee ID]='" & gEmployeeID & "'", view:=acViewReport
Case "rptEmployeeAccess"
DoCmd.OpenReport reportname:="rptEmployeeAccess", WhereCondition:="[Employee ID]='" & gEmployeeID & "'", view:=acViewReport
Case Else
DoCmd.OpenReport reportname:="rptShowEmployeeAnnualLeave", WhereCondition:="[Employee ID]='" & gEmployeeID & "'", view:=acViewReport
End Select
End Sub

I have tried to upload a copy of the database I made but I can't get it below 2MB. Is there any other way I can send it to you so that you can have a look?

As always, thank you for your help. I really value your contributions.
SetanPutih is offline   Reply With Quote
Old 07-17-2019, 02:06 AM   #18
Gasman
Enthusiastic Amateur
 
Join Date: Sep 2011
Location: Swansea, South Wales,UK
Posts: 3,672
Thanks: 398
Thanked 637 Times in 618 Posts
Gasman has a spectacular aura about Gasman has a spectacular aura about Gasman has a spectacular aura about
Re: Restricted Employee Access to Reports

Employee ID and EmployeeID are not the same?
Also if it is numeric do not use single quotes.

Quote:
Originally Posted by SetanPutih View Post
Hi Arnel,

I took your advice but unfortunately it didn't work.

In the Main Menu (Form 1) I can access the training report with no problems.
If I try to access the Annual Leave report to says "Enter Parameter Value - Employee ID". This also happens when I try to click on the Employee Details (rptEmployeeAccess) I have checked the source in properties and EmployeeID is spelt the same.

Also, when I click on Employee Details (rptEmployeeAccess) it takes me to the Annual Leave Report (rptShowEmployeeAnnualLeave|). I changed the coding but it still doesn't work. Please see coding below..

Private Sub List2_DblClick(Cancel As Integer)

Select Case Me.List2.Value

Case "Training"
DoCmd.OpenReport reportname:="Training", WhereCondition:="[Employee ID]='" & gEmployeeID & "'", view:=acViewReport
Case "rptEmployeeAccess"
DoCmd.OpenReport reportname:="rptEmployeeAccess", WhereCondition:="[Employee ID]='" & gEmployeeID & "'", view:=acViewReport
Case Else
DoCmd.OpenReport reportname:="rptShowEmployeeAnnualLeave", WhereCondition:="[Employee ID]='" & gEmployeeID & "'", view:=acViewReport
End Select
End Sub

I have tried to upload a copy of the database I made but I can't get it below 2MB. Is there any other way I can send it to you so that you can have a look?

As always, thank you for your help. I really value your contributions.

__________________
Access novice. Sometimes trying to give something back.
Access 2007


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Gasman is offline   Reply With Quote
Old 07-18-2019, 07:27 AM   #19
SetanPutih
Newly Registered User
 
Join Date: Jun 2019
Posts: 21
Thanks: 14
Thanked 0 Times in 0 Posts
SetanPutih is on a distinguished road
Re: Restricted Employee Access to Reports

Hi there,

I have tweeked the coding and the fields to ensure that all EmployeeID is the same. Now, if I click to access any of the reports it says "Run-time error '3664': Data type mismatch in criteria expression I have no idea where to go from here.

Private Sub List2_DblClick(Cancel As Integer)

Select Case Me.List2.Value
Case "Employee Activity Report"
DoCmd.OpenReport reportname:="rptEmpActivity", WhereCondition:="[EmployeeID]='" & gEmployeeID & "'", view:=acViewReport
Case "Training"
DoCmd.OpenReport reportname:="rptTraining", WhereCondition:="[EmployeeID]='" & gEmployeeID & "'", view:=acViewReport
Case "Annual Leave"
DoCmd.OpenReport reportname:="rptShowEmployeeAnnualLeave", WhereCondition:="[EmployeeID]='" & gEmployeeID & "'", view:=acViewReport
Case "Employee Details"
DoCmd.OpenReport reportname:="rptEmployeeAccess", WhereCondition:="[EmployeeID]='" & gEmployeeID & "'", view:=acViewReport
Case Else
DoCmd.OpenReport reportname:="rptSalaryHistory", WhereCondition:="[EmployeeID]='" & gEmployeeID & "'", view:=acViewReport
End Select
End Sub

Thanks for taking the time to read this.
SetanPutih is offline   Reply With Quote
Old 07-18-2019, 07:34 AM   #20
Gasman
Enthusiastic Amateur
 
Join Date: Sep 2011
Location: Swansea, South Wales,UK
Posts: 3,672
Thanks: 398
Thanked 637 Times in 618 Posts
Gasman has a spectacular aura about Gasman has a spectacular aura about Gasman has a spectacular aura about
Re: Restricted Employee Access to Reports

Normally to me, anything with ID in it would be numeric as I would take that to be an autonumber.?

Is that the case with you.?

If so, it should not be surrounded by single quotes, that is for text.
__________________
Access novice. Sometimes trying to give something back.
Access 2007


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Gasman is offline   Reply With Quote
Old 07-18-2019, 07:48 AM   #21
SetanPutih
Newly Registered User
 
Join Date: Jun 2019
Posts: 21
Thanks: 14
Thanked 0 Times in 0 Posts
SetanPutih is on a distinguished road
Re: Restricted Employee Access to Reports

Thanks for the reply.. I really appreciate it. Just to clarify so its a single quote mark ' rather than a double quote mark " only around the EmployeeID?
SetanPutih is offline   Reply With Quote
Old 07-18-2019, 07:51 AM   #22
SetanPutih
Newly Registered User
 
Join Date: Jun 2019
Posts: 21
Thanks: 14
Thanked 0 Times in 0 Posts
SetanPutih is on a distinguished road
Re: Restricted Employee Access to Reports

So the first line would look like.. ? Sorry again. Really new to this.

Select Case Me.List2.Value
Case "Employee Activity Report"
DoCmd.OpenReport reportname:="rptEmpActivity", WhereCondition:=’[EmployeeID]='’& gEmployeeID & ‘", view:=acViewReport
Case "Training"

SetanPutih is offline   Reply With Quote
Old 07-18-2019, 08:04 AM   #23
Gasman
Enthusiastic Amateur
 
Join Date: Sep 2011
Location: Swansea, South Wales,UK
Posts: 3,672
Thanks: 398
Thanked 637 Times in 618 Posts
Gasman has a spectacular aura about Gasman has a spectacular aura about Gasman has a spectacular aura about
Re: Restricted Employee Access to Reports

No, probably like

Code:
DoCmd.OpenReport reportname:="rptEmpActivity", WhereCondition:="[EmployeeID]=" & gEmployeeID , view:=acViewReport
TBH I have never used keyword parameters, just positional.

Code:
DoCmd.OpenReport "rptEmpActivity",acViewReport,,"EmployeeID=" & gEmployeeID
Intellisense will walk you through each parameter in turn.

https://docs.microsoft.com/en-us/off...cmd.openreport

The quotes/or not are around the value of what you are looking for, not the name of the field.

HTH
__________________
Access novice. Sometimes trying to give something back.
Access 2007


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Gasman is offline   Reply With Quote
Old 07-19-2019, 01:34 AM   #24
SetanPutih
Newly Registered User
 
Join Date: Jun 2019
Posts: 21
Thanks: 14
Thanked 0 Times in 0 Posts
SetanPutih is on a distinguished road
Re: Restricted Employee Access to Reports

it Worked! You legend! If I could buy you a pint I'd buy you two.

Thank you
SetanPutih is offline   Reply With Quote
Old 07-19-2019, 02:10 AM   #25
Gasman
Enthusiastic Amateur
 
Join Date: Sep 2011
Location: Swansea, South Wales,UK
Posts: 3,672
Thanks: 398
Thanked 637 Times in 618 Posts
Gasman has a spectacular aura about Gasman has a spectacular aura about Gasman has a spectacular aura about
Re: Restricted Employee Access to Reports

Just glad I got it right.

__________________
Access novice. Sometimes trying to give something back.
Access 2007


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Gasman is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Move Employee Multiple employee eyeseven2014 Forms 3 04-06-2014 09:55 PM
Employee HR Database (Employee Hierarchy). andmunn Tables 10 02-03-2014 03:38 AM
Question Field Employee Reports aubeerstud General 0 01-30-2013 02:46 PM
access restricted...not digitally signed vaughn General 0 10-29-2007 08:35 AM
[SOLVED] Restricted Access QPR General 2 01-22-2005 11:48 AM




All times are GMT -8. The time now is 02:36 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World