×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Place shapes in position given by Access database

Place shapes in position given by Access database

Place shapes in position given by Access database

(OP)
Hi!

I have an Access database containing information about parts. I'd like to have a drawing of this done by Visio 2003.

I've managed to import data from the DB and update "Custom Properties" fields both ways (DB <--> Visio drawing).

My problem is that the shapes is positioned randomly on the page. I have found the parameter that desides the position. It's given in "Size & Position" and displayed by "X" and "Y". I can connect the "PinX" and "PinY" parameters, but I haven't found the ones for "X" and "Y".

How can I connect fields in my DB with the "X" and "Y" parameters?

Can anyone help me change these parameters according to a Access DB?

Thanks

Regards,

Jan-Arve Hansen

RE: Place shapes in position given by Access database

How are you linking to the database. Is this through code or by an add-on?

John...   Visio MVP - Visio.MVPs.org

RE: Place shapes in position given by Access database

(OP)
At first I was trying to do it by one of the built-in addons in Visio 2003. First by importing the data from the .mdb file and linking it to the database afterwards using the DB Wizard.

Now I'm trying to do it by VB, but I never work with VB before, so it takes time. :P

If you know how to do it by add-on or similar I'd be very happy.

Thanks.

Jan-Arve

RE: Place shapes in position given by Access database

Visio comes with VBA, so that may make things easier.

David Edson has some examples in his book on handling Access from Visio using VBA. There are some of the code saples from the book at http://safari.oreilly.com/067231813X/ch22lev1sec3

To get help with working with PinX, PinY there are examples of woriking with Visio at http://visio.mvps.org/VBA.htm

John...   Visio MVP - Visio.MVPs.org

RE: Place shapes in position given by Access database

(OP)
I've found the PinX and PinY parameters, but it's not these who decides where the shape is dropped, or...?

Jan-Arve

RE: Place shapes in position given by Access database

Pin X and PinY define where the shape is "pinned" to the drawing, so these are the cells you need to play with. If you are dropping the shape, one of the parameters on the Drop method is the Pix and Piny.

Set shpObj = ActivePage.Drop(shp1obj, 4, 5)

This will drop the shape (shp1obj) at 4",5" from the lower left corner. This is assigned to a shape object called shpObj, so you can use shpObj to continue to modify the shape you dropped.

John...   Visio MVP - Visio.MVPs.org

RE: Place shapes in position given by Access database

(OP)
Hmm.. I've found the parameters and I've discovered that I can  assign a value from the database. But if I import the data first, I have to select each of the shapes and select the corresponding database element. That's takes a while.

I guess I'd have to continue the work in VB. I've have used the .drop in the script. Next task is to connect shapes.

I started using a script I found online.

Thank you Visioguy.

Some of the first lines, are the following.
<
Const FlowchartTemplateName$ = "Basic Flowchart.vst"
Const FlowchartStencilName$ = "BASFLO_M.VSS"
Const MasterProcessName$ = "Process"
Const MasterDecisionName$ = "Decision"
>

Since I'm drawing of a network, I'd like to select one or more stencils containing typical network shapes. I've created a stencil that contains all the shapes I need.

Template name: NNN_network.vst
Stencil name: N_Net.vss

But when I define the constants with those names, I get a Run-Time error'91' at the first line I use the constant. The stencil contains the "PC" shape I'm trying to use.

Any suggestions?

Jan-Arve

RE: Place shapes in position given by Access database

That is from Chris Roth's website. He was one of the original shape developers at Visio.

Those are string constants and are used later in the script, but without the trailing dollar sign.

You should be able to copy the line from the script and add a new stencil
Set docFlowTemplate = Visio.Documents. _
Add(FlowchartTemplateName)
and replacing FlowchartTemplateName with the name of another template. Something like,
Set docFlowTemplate = Visio.Documents. _
Add("Other stencil.vss")

John...   Visio MVP - Visio.MVPs.org

RE: Place shapes in position given by Access database

(OP)
Thanks John. Now I'm drawing PC shapes. :D

I have a piece of a script for connecting shapes. I'm going to try to solve that one before asking.

But I haven't got anything on editing properties. In the "PC" shape for example, there is alot of properties I don't want to show. Is there a way edit what the "custom properties" displays? I guess I'm able to use the RecSet.fields(#) command to get the data from my DB.

Thanks John.

Jan-Arve

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close