Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Showing time graphically 1

Status
Not open for further replies.

alainde

MIS
Apr 22, 2002
5
CA
Can anyone point me on some direction, please

I'd like to make a report that would show time graphically. Making it easy to look at the report to see if a particular room is available. My reservation data would includ StartDate EndDate StartTime EndTime,time in increment of 15 minutes

Each page yould show a day with the time acrooss some thing like taht :

02-04-25
Room No 0900 1000 1100 1200 1300 ...
ALVH XXXXXXXXX XXXXXX XX
BSCO XXXXXXX XXXXX XXXXXX

Anyone can point me to some possible solution or reading as to making this come to life in Access??

Alain D (Montreal,Qc,Canada)
 
Alain,

Your requirement requires some code. I'll assume you have some programming experience / support. If not, just yell for more help.

(a) Create a new module; call it modGraphUtils

(b) Paste in the following two functions:

Function TimeLine(CurrentTimeLine As String, _
StartTime As Date, _
Intervals As Integer) As String
'-------------------------------------------------------------------------
'Given an existing timeline, plus a start time, and a number of intervals
'graphically mark off time intervals along the timeline
'-------------------------------------------------------------------------
'-------------------------------
'Set up the baseline time as 9am
'-------------------------------
Dim Basetime As Date: Basetime = #9:00:00 AM#
Dim StartPos As Integer
Dim ThisPosition As Integer
Dim IntervalsIncluded As Integer
Dim Headings As String

'-----------------------------------------------------------------
'Determine the starting position to mark up in the timeline string
'Note that every 15 minutes designates one character position.
'-----------------------------------------------------------------
StartPos = DateDiff("n", Basetime, StartTime) / 15 + 1 + _
DateDiff("h", Basetime, StartTime)

'--------------------------------------------------------------------
'Now mark up from the starting position, for the number of intervals,
'but jump over the space position, every 5 characters.
'--------------------------------------------------------------------
IntervalsIncluded = 0
ThisPosition = StartPos
Do
If IntervalsIncluded = Intervals Then
Exit Do
End If

If ThisPosition Mod 5 <> 0 Then
Mid(CurrentTimeLine, ThisPosition, 1) = &quot;*&quot;
IntervalsIncluded = IntervalsIncluded + 1
End If
ThisPosition = ThisPosition + 1
Loop
TimeLine = CurrentTimeLine

End Function
Function TimeLineTest()
'--------------------------
'Test the TimeLine function
'--------------------------

Dim TimeHeading As String
Dim StartTime As Date
Dim Intervals As Integer
Dim CurrentTimeLine As String

'-----------------------------
'Initialise timeline to blanks
'-----------------------------
CurrentTimeLine = Space(120) 'ie. 24 hours * 5 positions per hour

'---------------
'Display Heading
'---------------
TimeHeading = &quot;0900 1000 1100 1200 0100 0200 0300 0400 0500 0600 0700 0800 0900&quot;
Debug.Print TimeHeading

'------------
'First lesson
'------------
StartTime = #10:30:00 AM#
Intervals = 5
CurrentTimeLine = TimeLine(CurrentTimeLine, StartTime, Intervals)

'-------------
'Second lesson
'-------------
StartTime = #2:00:00 PM#
Intervals = 3
CurrentTimeLine = TimeLine(CurrentTimeLine, StartTime, Intervals)

'----------------
'Display Timeline
'----------------
Debug.Print CurrentTimeLine
End Function


(c) Test the first function called timeline(), using the TimelineTest() function.

(d) You should then be able to adapt this to your requirement and/or call it for your reporting purposes.

Cheers,
Steve
 
YIkes,

Such a simple task with a pencil... Not having any experiences as a programmer might turn out to be the most difficult part as to solving this task.

Hours of fun to come.

Thx Steve!

Alain D. Montreal,Qc,Canada
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top