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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incrementin Timeline 1

Status
Not open for further replies.

Spaniard

MIS
Jul 23, 2002
29
0
0
US
Sorry about the previous post w/inappropriate subject...
Hi,
I want a report to show a 24 hour time line with the starting value being the start time of a product run and incrementing one hour for 24 hours.
Example:
Product starts at 3:00 PM

Timeline should look like this:
3 PM 4 PM 5 PM 6 PM 7 PM 8 PM 9 PM 10 PM 11 PM...etc

Any suggestions? I know I need to build a string, but I'm not sure how to do it.

Thanks,
SWK
 
Now I don't know where you want this to show in your report(Report Header, page header, detail line etc. ) but this is the basic code to create a string for you.
Dim vStartTime As Integer
Dim vTimeLineStr As String
Dim I As Integer
vStartTime = Hour(Me.ProdStartTime[)
I = 0
Do
vTimeLineStr = vTimeLineStr & Switch(vStartTime = 1, " 1 AM ", vStartTime = 2, " 2 AM ", _
vStartTime = 3, " 3 AM ", vStartTime = 4, " 4 AM ", vStartTime = 5, " 5 AM ", _
vStartTime = 6, " 6 AM ", vStartTime = 7, " 7 AM ", vStartTime = 8, " 8 AM ", _
vStartTime = 9, " 9 AM ", vStartTime = 10, " 10 AM ", vStartTime = 11, " 11 AM ", _
vStartTime = 12, " 12 PM ", vStartTime = 13, " 1 PM ", vStartTime = 14, " 2 PM ", _
vStartTime = 15, " 3 PM ", vStartTime = 16, " 4 PM ", vStartTime = 17, " 5 PM ", _
vStartTime = 18, " 6 PM ", vStartTime = 19, " 7 PM ", vStartTime = 20, " 8 PM ", _
vStartTime = 21, " 9 PM ", vStartTime = 22, " 10 PM ", vStartTime = 23, " 11 PM ", _
vStartTime = 24, " 12 AM ")
vStartTime = IIf(vStartTime = 24, 1, vStartTime + 1)
I = I + 1
Loop Until I = 24
Me.TimeLine = Trim(vTimeLineStr)

You can put this in the Format property of the Detail section possibily. The red code above is the name of the control that has the Product Start Time(ProdStartTime) and the location of the control to place the string in TimeLine. You can update these areas to what you have in your report.

Let me know if you need more help. Bob Scriver
 
Thanks, Bob. I figured out another way to do it, but your way gives me another, possibly better, alternative.

SWK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top