If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
GAntt Timeline
You can set the scale to whatever you want. It's all in the math of finding
the datediff and positioning and sizing the control. -- Duane Hookom Microsoft Access MVP "margaret" wrote: Is there anyway to get this to work for a 24 schedule. In that maybe the employees work 7:00 am to 3 pm ; 3 pm to 11m and then 11m to 7:00 am. I'm not concerned about a day of the week. I just need to see that all twenty four hours are covered. "margaret" wrote: Thank you much for the explanation ... that goes a long way in understanding your code. "Duane Hookom" wrote: The lngDuration memory variable is used to capture/store the number of hours from the start to finish of an event (duration). The results returned from DateDiff() are always integers (whole numbers with no decimal). You wanted half hours (or better) so the lngDuration needed to be changed to accomodate fractions/decimals. The "As Long" wouldn't allow for storing decimals while "As Double" does. The "h" or "n" in DateDiff() is to return the duration in either Hours or Minutes ("m" is month). The code changes find the difference in minutes and divides by 60 to convert to the number of hours with decimals. -- Duane Hookom Microsoft Access MVP "margaret" wrote: Worked like a champ. But if you don't mind two questions: 1. difference between "long" and "double" 2. why the change between the "h" and "n" Thanks for your help. I just don't want to put code in that I don't totally understand. "Duane Hookom" wrote: I think you need to change Dim lngDuration As Long 'hours of work lngDuration = DateDiff("h", Me.[start], Me.[end]) to Dim lngDuration As Double 'hours of work lngDuration = DateDiff("n", Me.[start], Me.[end])/60 -- Duane Hookom Microsoft Access MVP "margaret" wrote: I have the following code: Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) Dim lngDuration As Long 'hours of work Dim lngStart As Long 'start hour of tour Dim lngLMarg As Long Dim dblFactor As Double 'put a line control in your page header that starts 12:00 and goes to 23:00 lngLMarg = Me.boxTimeLine.Left dblFactor = Me.boxTimeLine.Width / 24 lngStart = DateDiff("h", #12:00:00 AM#, Me.[start]) lngDuration = DateDiff("h", Me.[start], Me.[end]) 'set the color of the bar based on a data value Me.txtName.Width = 10 'avoid the positioning error Me.txtName.Left = (lngStart * dblFactor) + lngLMarg Me.txtName.Width = (lngDuration * dblFactor) Me.MoveLayout = True End Sub However, I have some employees who start or end on the half hour and this places them on the full hour. How do I go about changing it so the timeline will reflect 1/2 hours? "Duane Hookom" wrote: Glad to hear you got this working. Come back if you have questions since you have the attention of the author ;-) -- Duane Hookom Microsoft Access MVP "margaret" wrote: Great ... both the new link and the "unblock" worked so now I can attempt it. Thanks so much for your help. "Duane Hookom" wrote: The invisibleinc file is now located at http://www.access.hookom.net/Samples.htm. Most files you download from the intranet have a property set that you need to change so you can open them. After downloading, right-click the file and choose Properties. I think the property is like "unblock". -- Duane Hookom Microsoft Access MVP "margaret" wrote: I'm looking for instructions on how to do a Gantt Timeline. I've gone to this suggested website ... http://www.invisibleinc.com/divFiles.cfm?divDivID=4 ... but the link doesn't work. Then I went here ...http://mvps.org/access/reports/rpt0018.htm and downloaded the files, but when I go to open the database, it tells me I must install the database on my computer . Exact phrase: File is located on an intranet or untrusted site. Not so, opening it from the C: drive. So I'm still looking, any help would be appreciated. Margaret |
|
Thread Tools | |
Display Modes | |
|
|