Database Dreams

Database Dreams Free Projects => Employees Example => Topic started by: Michael on September 01, 2019, 11:08:09 am

Title: Employee System Example V4 Errors And Corrections
Post by: Michael on September 01, 2019, 11:08:09 am
The following error has been found.

when openning the timesheet as a person without the correct permision it will be sent into a loop as the openning of it is being controled by the load data message the correction is to remove the following lines of code from the time sheet on open event and past in the on open event of the Msgloadingdata form.

Should you need help create a topic and I'll help best I can this topic is for notifcations and corrections only

Code: [Select]
    If Not IsOpen("frmDetectIdleTime") Then
        MsgBox "You must open this object from the main screen", vbExclamation + vbOKOnly, "Missing Object"
        Cancel = True
        Exit Sub
    End If
    'Only Managers or above can view this object
    If Not CheckManager Then
        MsgBox "You must be a manager or admin to view the Works Diary", vbExclamation + vbOKOnly, "insufficient permissions"
        Cancel = True
        Exit Sub
    End If

Past the following into the MsgfrmLoadingData form OnOpen Event

Code: [Select]
On Error GoTo HandleErr

    If Not IsOpen("frmDetectIdleTime") Then
        MsgBox "You must open this object from the main screen", vbExclamation + vbOKOnly, "Missing Object"
        Cancel = True
        Exit Sub
    End If
    'Only Managers or above can view this object
    If Not CheckManager Then
        MsgBox "You must be a manager or admin to view the Works Diary", vbExclamation + vbOKOnly, "insufficient permissions"
        Cancel = True
        Exit Sub
    End If

HandleExit:
    Exit Sub
   
HandleErr:
    Select Case Err.Number
        Case 2501 'Cancel = True
            Exit Sub
        Case Else
            MsgBox Err.Number & vbCrLf & Err.Description
            Resume HandleExit
        Resume
    End Select
Title: Re: Employee System Example V4 Errors And Corrections
Post by: Michael on September 05, 2019, 07:36:43 pm
Please note the error info relating to the popup calendar

https://www.utteraccess.com/forum/index.php?showtopic=2034523&view=findpost&p=2696360
Title: Re: Employee System Example V4 Errors And Corrections
Post by: Michael on September 07, 2019, 10:36:55 am
I was going though my project management system updating the holiday planner to current version when I noticed the holiday report was showing all entries for all years as my project management system goes back a lot of years it was a lot.

so I made the following change to the query: qryHolidayListReport

I added a new field with the expression: HYear: Year([StartDate]) you can call it what you like

And A Criteria: Year([Forms]![frmHolidays]![txtDate])

For those new to access what this does is limits the output of the report to the current year being viewed on the holiday planner, I didn't think it needed a date range popup.

P.S. I used the start date only as I was only interested in holidays starting in a given year.

hope you find this of use mick
Title: Re: Employee System Example V4 Errors And Corrections
Post by: Michael on September 14, 2019, 04:57:32 pm
Just had an error reported this was missed between updates

open frmRequests in design view then edit the row source SQL
You can replace it with the below which points the assigned manager to the hidden form holding the defaults.

Code: [Select]
SELECT tblHolidayRequests.RequestID, tblEmployees.EmployeeID, [FirstName] & " " & [LastName] AS Employee, tblHolidayRequests.StartDate, tblHolidayRequests.EndDate

, tblHolidayRequests.HolidayNotes, tblHolidayRequests.HolidayType, tblHolidayRequests.StartHalfDay,

 tblHolidayRequests.EndHalfDay, tblHolidayRequests.ManagerID, tblHolidayRequests.Approved,

tblHolidayRequests.AssessedDate, tblHolidayRequests.ManagerNote FROM tblEmployees INNER JOIN

 tblHolidayRequests ON tblEmployees.EmployeeID = tblHolidayRequests.EmployeeID WHERE

(((tblHolidayRequests.ManagerID)=[Forms]![frmDetectIdleTime]![txtUser]) AND

((tblHolidayRequests.Approved) Is Null)) ORDER BY tblHolidayRequests.StartDate DESC

, tblHolidayRequests.Approved DESC;


Or just replace the manager ID Criteria with this [Forms]![frmDetectIdleTime]![txtUser] this will point it in the correct place.


plus also noticed the subform was not updating after adding a request so add the following to  frmMain

Replace CmdRequest Code with
Code: [Select]
    DoCmd.OpenForm "frmHolidayRequests", , , , , acDialog
    Me.ZfrmRequests.Form.Requery

Title: Re: Employee System Example V4 Errors And Corrections
Post by: Michael on October 04, 2019, 09:57:23 pm
On the diary, add meeting Found this error

Don't quite know what I was thinking but corrected now

comment out or remove this text  - NightShift 'M Javes Edit 16/08/2019
from this line  !StartTime = Format(ST & ":00", "h AM/PM") ' - NightShift 'M Javes Edit 16/08/2019

The meeting after adding a new one should open when first created so you can edit it once done close it make sure it is selected in the Active meetings Dropdown
for that day then just double click the time for each employee you wish to attend.

remember you can only get to r add meetings by selecting CODE ENTRY from the entry type list then MEETING from the select a code list.

and meetings only show for the selected date
Title: Re: Employee System Example V4 Errors And 64Bit Corrections
Post by: Michael on December 29, 2019, 09:33:04 am
In Mod Calendar1

Replace This API Calls For Those below

Code: [Select]
#If VBA7 Then 'use PtrSafe & LongPtr
Declare PtrSafe Sub GetWindowRect Lib "user32" (ByVal hWnd As LongPtr, lpRect As FormCoords)
Declare PtrSafe Function GetDC Lib "user32" (ByVal hWnd As LongPtr) As Long
Declare PtrSafe Function ReleaseDC Lib "user32" (ByVal hWnd As LongPtr, ByVal hDC As LongPtr) As Long
Declare PtrSafe Function GetDeviceCaps Lib "gdi32" (ByVal hDC As LongPtr, ByVal nIndex As Long) As Long
Declare PtrSafe Function apiSystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, _
                    ByVal uParam As Long, lpvParam As RECT, ByVal fuWinIni As Long) As Long
#Else
'API Declarations
Declare Sub GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As FormCoords)
Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hDC As Long) As Long
Declare Function GetDeviceCaps Lib "gdi32" (ByVal hDC As Long, ByVal nIndex As Long) As Long

Declare Function apiSystemParametersInfo Lib "user32" _
Alias "SystemParametersInfoA" (ByVal uAction As Long, _
ByVal uParam As Long, lpvParam As RECT, ByVal fuWinIni As Long) As Long

#End If

Open ModColorPicker And replace This

Code: [Select]
Private Type COLORSTRUC
  lStructSize As Long
  hWnd As Long
  hInstance As Long
  rgbResult As Long
  lpCustColors As String
  Flags As Long
  lCustData As Long
  lpfnHook As Long
  lpTemplateName As String
End Type

Private Const CC_SOLIDCOLOR = &H80
Private Const CC_OPENALL = &H2
Private Const CC_RGBINIT = &H1

#If VBA7 Then 'use PtrSafe & LongPtr
    Private Declare PtrSafe Function ChooseColor Lib "comdlg32.dll" Alias "ChooseColorA" (pChoosecolor As COLORSTRUC) As Long
#Else
    Private Declare Function ChooseColor Lib "comdlg32.dll" Alias "ChooseColorA" (pChoosecolor As COLORSTRUC) As Long
#End If

With This
Code: [Select]
Private Const CC_SOLIDCOLOR = &H80
Private Const CC_OPENALL = &H2
Private Const CC_RGBINIT = &H1

#If VBA7 Then 'use PtrSafe & LongPtr

Private Type COLORSTRUC
  lStructSize As Long
  hWnd As LongPtr
  hInstance As LongPtr
  rgbResult As Long
  lpCustColors As String
  Flags As Long
  lCustData As LongPtr
  lpfnHook As LongPtr
  lpTemplateName As String
End Type

    Private Declare PtrSafe Function ChooseColor Lib "comdlg32.dll" Alias "ChooseColorA" (pChoosecolor As COLORSTRUC) As Long
   
#Else

Private Type COLORSTRUC
  lStructSize As Long
  hWnd As Long
  hInstance As Long
  rgbResult As Long
  lpCustColors As String
  Flags As Long
  lCustData As Long
  lpfnHook As Long
  lpTemplateName As String
End Type

    Private Declare Function ChooseColor Lib "comdlg32.dll" Alias "ChooseColorA" (pChoosecolor As COLORSTRUC) As Long
#End If