Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    cap.zadi is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Yeah it is.

    Kindly check the previously given db's report. You will see the timeline (textfields) are from jan to Dec but the status bar followed the minstartdate and maxenddate as per coding.

  2. #17
    cap.zadi is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Sir

    Any update or further advise please?

  3. #18
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    ok I think I've got it

    Code:
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Dim intStartDayDiff As Integer
    Dim intDayDiff As Integer
    Dim sngFactor As Single
      
      On Error Resume Next
    
    mdatEarliest = #1/1/2017#
    
      Me.ScaleMode = 1 'Twips
      'sngFactor = Me.boxMaxDays.Width / mintDayDiff
      sngFactor = Me.boxMaxDays.Width / 365
      If Not IsNull(Me.StartDate) And Not IsNull(Me.EndDate) Then
        Me.boxGrowForDate.Visible = True
        Me.lblTotalDays.Visible = True
        intStartDayDiff = Abs(DateDiff("d", Me.StartDate, mdatEarliest))
        intDayDiff = Abs(DateDiff("d", Me.EndDate, Me.StartDate))
      
        If intStartDayDiff = 0 Then intStartDayDiff = 1
        
        With Me.boxGrowForDate
          .Left = Me.boxMaxDays.Left + (intStartDayDiff * sngFactor)
          .Width = intDayDiff * sngFactor
        End With
        
        Me.lblTotalDays.Left = Me.boxGrowForDate.Left
        
        If intDayDiff > 1 Then Me.lblTotalDays.Caption = intDayDiff & " days" Else _
                Me.lblTotalDays.Caption = intDayDiff & " day"
        'Me.lblTotalDays.Caption = intDayDiff & " Day(s)"
      Else '
        Me.boxGrowForDate.Visible = False
        Me.lblTotalDays.Visible = False
      End If
    End Sub
    Check the line I've added in red to the vba format code

    And on the properties sheet for the report make the default view be printpreview

  4. #19
    cap.zadi is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Thanks for the feedback.

    This code did not give any error but almost gives the starting point same for all bars.

    So finally it does not provide the required results.

  5. #20
    cap.zadi is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Hi

    It is achieved by changing the below fields which use to set the timeline frame:

    Code:
    Private Sub Report_Open(Cancel As Integer)
    
    
    Dim db As Database
    Dim rs As Recordset
      
      Set db = CurrentDb
      Set rs = db.OpenRecordset("SELECT Min([SStartDate]) AS MinOfStartDate " _
                    & " FROM QEAVS", dbOpenSnapshot)
      
      If rs.RecordCount > 0 Then
        mdatEarliest = rs!MinOfStartDate
      End If
      
    Set rs = db.OpenRecordset("SELECT Max(IIf(IsDate([SEndDate]),CDate([SEndDate]),Null)) " _
                    & "AS MaxOfEndDate FROM QEAVS", dbOpenSnapshot)
      
      If rs.RecordCount > 0 Then
        mdatLatest = rs!MaxOfEndDate
      End If
      
    mintDayDiff = DateDiff("d", mdatEarliest, mdatLatest)
      
      Me.txtMinStartDate.Caption = Format(mdatEarliest, "dd/mm/yy")
      Me.txtMaxEndDate.Caption = Format(mdatLatest, "dd/mm/yy")
      
      Set rs = Nothing
      Set db = Nothing
    
    
    
    
    End Sub
    I think this is a great achievement bcz we are used to prepare such graphical leave reports in excel and its rare to find such customized staff leave schedule report in access.

    Thanks for your time and support.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 01-23-2014, 07:49 AM
  2. Compile Error: Syntax Error in DoCmd.RunSQL Statement
    By Evilferret in forum Programming
    Replies: 1
    Last Post: 08-27-2012, 12:32 PM
  3. Replies: 2
    Last Post: 06-23-2012, 11:59 PM
  4. Replies: 7
    Last Post: 06-08-2012, 09:55 PM
  5. Compile Error Syntax Error
    By Mohamed in forum Access
    Replies: 3
    Last Post: 10-06-2011, 10:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums