Ok, I don’t like doing this, but I need some help, and I can only hope the TM can lend a hand.
I’me developing a database for resource schedualing, and deconfliction. One of the reports they asked me to create for them is a time-line type of format. I found some code at http://www.mvps.org/access/ that gave a simple timelind report that I could modify to work for my report. It worked great while I had it in Access 97, but when they converted us all to 2000, it bombs out totally. I understand this is because they have taken the code that used to be a bit slapdash and made it more consistent to regular VB. The problem is that I don’t know VB, I can look at code, and modify it, and do some simple things, but I’ve never taken the time to learn VB. I’ve been able to do just fine with Macro’s and such. So, I’m going to paste the code here, if someone - anyone can tell me why it’s not working anymore, I would be eteranlly gratefull. If this paste doesn’t give enough info to show what I’m trying to do, I’d be happy to e-mail the DB to anyone that can give me some help. Also, maybe some explination as to why is doesn’t work anymore, so I can figure it out. Thanks in advance for any help you can give.
Option Compare Database
Option Explicit
Private mdatEarliest As Date
Private mdatLatest As Date
Private mintDayDiff As Integer
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
Me.ScaleMode = 1 'Twips
sngFactor = Me.boxMaxDays.Width / mintDayDiff
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
Me.lblTotalDays.Caption = intDayDiff & " Day(s)"
Else ’
Me.boxGrowForDate.Visible = False
Me.lblTotalDays.Visible = False
End If
End Sub
Private Sub Report_Open(Cancel As Integer)
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset(“SELECT Min([Exercise Start Date]) AS MinOfStartDate " _
& " FROM tblexercise”, dbOpenSnapshot)
If rs.RecordCount > 0 Then
mdatEarliest = rs!MinOfStartDate
End If
Set rs = db.OpenRecordset("SELECT Max(IIf(IsDate([Exercise End Date]),CDate([Exercise End Date]),Null)) " _
& “AS MaxOfEndDate FROM tblexercise”, dbOpenSnapshot)
If rs.RecordCount > 0 Then
mdatLatest = rs!MaxOfEndDate
End If
mintDayDiff = DateDiff(“d”, mdatEarliest, mdatLatest)
Me.txtMinStartDate.Caption = Format(mdatEarliest, “mm/dd/yyyy”)
Me.txtMaxEndDate.Caption = Format(mdatLatest, “mm/dd/yyyy”)
Set rs = Nothing
Set db = Nothing
End Sub