• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 544
  • Last Modified:

Visio control Access, but very thin in Visio

I'm looking for a general approach to getting an event in Visio VBA to pass parameters to and initiate a subroutine in Access VBA.

I want to have the minimum amout of code possible in Visio.  I'm familiar with using events in shape cells in Visio, to trigger subroutine calls in Visio's VBA, and I'm familiar with implementing the Automation links between Visio and Excel (Visio controls Excel data), and between Access and Visio (Access controls shape cell values)

What i am looking for is a general approach in which the Visio shape cell events would initiate a Visio subroutine, but the Visio subroutine would be very small, and it would (FILL IN HERE WITH HOW TO AUTOMAGICALLY PERFORM) initiate and pass parameters to an Access subroutine, which would then update the database from with the Access VBA code.

The reason is that the Visio doc is going to be a data file that will be go in a lot of different directions, and I wanted to minimize the amount of code in the Visio doc.  

So, I don't know if these is even possible, because Access would have to be running and be able to receive, I don't know, an interrupt from Visio?..( BZZZTT!!!  ZAP!!!  NO-OP!!!)...anyway, I'm just starting to research this.

Clearly, I could do what I need to by just running the Access database update code from within Visio, which I'll do to get started, but I want to see if it can be done this other way, too.

Any guidance will be appreciated!

0
codequest
Asked:
codequest
  • 2
  • 2
1 Solution
 
william007Commented:
0
 
william007Commented:
sorry..submit wrong location....haha....
0
 
codequestAuthor Commented:
no problemo...glad someone's out there!
0
 
will_scarlet7Commented:
   I have not attempted writing code in Visio, but I think this is the basic procedure for running code in an access database and passing the parameters. Using the "Run" command on a current database object you can call a built in procedure and pass it up to 30 arguments. In the code below I am opening a database and running a function called "WriteIniKey" and passing it 3 arguments:

Sub RunRemote()
    Dim myAccess As Object

    Set myAccess = CreateObject("Access.Application")
    With myAccess
        .Visible = False
        .OpenCurrentDatabase "C:\SampleDatabase.mdb"
        .Run "WriteIniKey", "T1", "R1", "PLT"
        .CloseCurrentDatabase
        .Quit
    End With

    Set myAccess = Nothing
End Sub

I built this in Excel, but I assume it would be the same in any VBA environment.

Sam
0
 
codequestAuthor Commented:
Works great.  Thanks!
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now