Link to home
Start Free TrialLog in
Avatar of CertifiedP
CertifiedP

asked on

Display arrows or lines in different positions on a MS Access 2010 report

How do you draw diagonal, horizontal or vertical arrows or lines on an MS Access 2010 report.  The arrows or lines need to go from one symbol to another symbol.  

The symbol is in the detail section of the report and its horizontal position is determined by code.  So each symbol is shown in a different position for each record. The symbols represents events on a annual timeline and the arrows or lines indicate a dependency between the symbols.
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

You would need to manipulate the Top, Left, Height, and Width properties of the line by code as well.  For example, here's how you would create a horizontal line between 2 symbols:
Me.Line1.Height = 0
Me.Line1.Top = Me.Symbol1.Top + (Me.Symbol1.Height / 2)
Me.Line1.Left = Me.Symbol1.Left + Me.Symbol1.Width
Me.Line1.Width = Me.Symbol2.Left - (Me.Symbol1.Left + Me.Symbol1.Width)

Open in new window

Avatar of CertifiedP
CertifiedP

ASKER

Thanks for the feedback.

I've just reviewed your code. However, only one symbol exists in the detail section of the report.  Therefore, Symbol2 does not exist.  The positioning of each symbol is determined for each record, based on the report's record source details.

In addition, the line(s) may need to be drawn to symbols that are not necessarily the next record in the reports record source.  That is, they may be drawn to any on the symbols.
I don't quite follow. Can you post a screenshot?
Can't show screenshot as it's on another PC that's unavailable at the moment. However, consider the following:

JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
                              *
                                                 *
                                                                            *
       
            *


The 1st symbol(in Apr), for example, might depend on the event represented by the 4th symbol(in Feb).  So there should be a line from the 1st to the 4th symbol.  

When the report is run it positions each symbol in order, i.e. 1st, 2nd, 3rd...because that the order they appear in the underlying recordset and the code knows where to place the symbols based on dates in the recordset.

Note: Although it looks like several symbols on the report.  It is the same symbol that is positioned as it goes through the records.  If you open the report in design view you will see one symbol.  This symbol is moved by the code for each record.
Well there's the line method, but it won't work from one record to another.  The only way you would be able to use it is if you also position your symbols vertically by code instead of by each record.

http://msdn.microsoft.com/en-us/library/office/aa221362(v=office.11).aspx
Thanks, I thought about your idea about positioning the symbols, and the timeline, vertically and switching the orientation of the page to portrait.  However, I don't believe this will work because it's not clear how to use the records in this context i.e. which section of the report would you place the symbols.  

I'm thinking about maybe generating an intermediary table with positional information for the symbols and lines and using this as the recordset for the report.  By generating an intermediary table the position of each symbol can be set and the coordinates of the lines can then be determined.  Just not sure how to calculate the position information for the lines so that the will connect to the dependent symbol. Appreciate the feedback.
Regarding which section of the report to use if you do it by code, you could do it any section because the report will not have a Recordsource.  If however, you need a recordsource because there are fields there that you are using for the header or footer section, then you need to make sure that only one record is returned so that you can use your detail section for your symbol and line positioning via code.
Unfortunately, more than one record is required because the data is used by the code to determine where to position symbols on the timeline.  This information would still be required even if the symbols where to be displayed vertically.
I understand that.  What I meant was that your report will not be bound to a recordset wherein you would have a detail line showing for each record.   You would instead create a recordset via code to create your report (vertically and horizontally).  This would not be that simple but it is doable.
Oh, I see what you mean using DAO (or whatever they're maybe calling it these days).  

Just thinking this through...so if I:
have data to identify a dependency;
increase the height of the detail section (maybe in code);
Iterate though the recordset (in code);
position each symbol vertically and horizontally;
drawn lines between symbols(may need to do in two passes)

What do you reckon?  If you agree I'll try it out a let you know.
ASKER CERTIFIED SOLUTION
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It was not possible to do it based on the advice given.  However, I have a solution which uses straight lines rather than diagonals.  I'll give you the points due to your persistence in trying to help.
Accepted on the basis that you tried to help.
Thanks. Glad you got it working.
:-)
Ron