Drawing a line!

NigelShaw

Registered User.
Local time
Today, 23:07
Joined
Jan 11, 2008
Messages
1,575
Hi,

Here is a project head scratcher ( well, to me anyway ). I have a grid on a form. its width is 20cm wide and 15cm tall. in the grid are 6 groups of columns( all columns listed are from left to right )

Group 1 - 5cm wide - description
Group 2 to 6 are 30cm wide and represent days. Each group is split into 8 columns which represent hours per working day.

I need to to draw or position a line over the grid depending on what day it is and time. for example, lets say its thursday at 14.30. ( the 8 hour columns run from 8am to 4pm ) it would need to look like this-

attachment.php


so i need to work out the position of of the line depending on the time of of the day in the week. The day can be determined by the column header, the time by the grid....

Any ideas or guidance?

I'll post the finished sample if i can get it working :)



Cheers
 

Attachments

  • gridline.JPG
    gridline.JPG
    54.6 KB · Views: 243
Not sure I have a solution, but I think it's an interesting problem to try and work out.

Do you want this line to automatically move across the grid as time progresses throughout a given day? If so, how often do you want to refresh it (every 15 min, 30 min, etc.)?

Or, do you just have a command button (or some other UI control) that when acted upon places the line on the grid at the given point in time?
 
I assume, and am hoping this is a Microsoft Access report. If so, add a red, vertical line to the Detail portion of your report. Put it in the first half inch of your report, make it about a quarter of an inch tall and name it 'TimeLine'. Open the report in print preview and see where that line falls.

Next, go back into design view and add this code to the OnLoad event of your form:

Code:
LineJump=5000
Me!TimeLine.Move LineJump, , 0


Open your report again in print preview and your line should have moved to the right. The LineJump variable determines how far your line gets moved to the right.

Now its up to you to come up with code to determine what to set LineJump to based on the date/time.
 
Hi Sean,

thanks for th reply. i was hoping that it would move automatically in increments of say 5 or 15 minutes. it doesnt need to be any more accurate than that :)



Cheers
 
I assume, and am hoping this is a Microsoft Access report. If so, add a red, vertical line to the Detail portion of your report. Put it in the first half inch of your report, make it about a quarter of an inch tall and name it 'TimeLine'. Open the report in print preview and see where that line falls.

Next, go back into design view and add this code to the OnLoad event of your form:

Code:
LineJump=5000
Me!TimeLine.Move LineJump, , 0


Open your report again in print preview and your line should have moved to the right. The LineJump variable determines how far your line gets moved to the right.

Now its up to you to come up with code to determine what to set LineJump to based on the date/time.

Hi Plog,

its not a report. Its a grid on a form that shows projects like in a gantt chart


thanks
 
As long as its an Access Form that method will still work.
 
Expanding on what Plog said, I haven't tried to code this yet but here some basic logic.

The value of the Left position of a Control is in Twips (1440 twips per inch). Your text box (or label) controls that display the dates are very close to 2 in wide (If you make them 5.08 cm then they'll be exactly 2 in wide and you'll be dealing with an even number of twips - 2880). Each "day" is a block of 8 hours, so for your purposes;

2880 twips per "day"
360 twips per hour
6 twips per minute

So determine the Left position of the appropriate date header text box, then add 6 twips for every minute that has passed since 8:00 am that day and move the line to that position.

Just a thought.
 

Users who are viewing this thread

Back
Top Bottom