Open Access Form

Started by davidgon, January 26, 2017, 11:41:26 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

davidgon

How could I open an Userform from Access in Visio, without opening Access?

Thanks

Surrogate


Croc

You can try the code like this
Sub ttt()
    Dim access As access.Application
    Set access = CreateObject("access.Application")
    access.Visible = False
    access.OpenCurrentDatabase ("G:\Temp\test.accdb")
    access.DoCmd.OpenForm "Form1", acNormal, "", "", , 3
    Debug.Print access.Forms(0).Name
End Sub

Surrogate

Croc, hi there!  :)
Quote from: davidgon on January 26, 2017, 11:41:26 AMwithout opening Access
But your code open Access application, and make it invisible...

Nikolay

Quote from: davidgon on January 26, 2017, 11:41:26 AM
How could I open an Userform from Access in Visio, without opening Access?

Thanks

Hmm.. it seems that we are a bit confused here. What do you mean by "opening an Access userform without opening Access"?
Access user forms exist only in Access, and make sense only for Access.. Or?
Maybe you mean, how to copy user form from Access to Visio? Or how open a picture (screenshot) of Access user form?

vojo

he probably wants to use a form he created in access (format, placement, etc) instead of building a new one in visio VBA

davidgon

Sorry if I haven't explained properly  :-\

I have, in Access, an Userform which, bassically, if there is any mistake in the database send me a mail with the incidence.

Now, I have that database in Visio. I want to make a button which load the incidence userform. I think i have two options: make the form in Visio or load it from Access.

If I load it from Access, I want only the incidence form being opened, not the entire database (I don't know if that is possible).

If I make the form in Visio, I want to modify some tables from the database (the incidences column of the element), but I don't know how to manage an Access database from Visio.

Thanks

Nikolay

I think both options are unfortunately not possible.

Means, if you open the form from Access (for example, like Croc explained), you'll get the whole Access app opened.

Moving this form to Visio may be problematic, as it (guessing here) most probably is using Access functionality to check the incidences.

Summarizing: I would recommend you forget about it, and use Access for database management and consistency check, and Visio for diagramming.

Yacine

#8
It's in fact very easy to work with access from Visio.
You're trying to modify a table within access, process the so added data and get the results some how back to visio.

To write from Visio to Access:
Google: https://www.google.de/search?newwindow=1&safe=off&rlz=1C1MDNE_deDE712DE712&espv=2&q=excel+vba+add+record+access+database&oq=vba+excel+add+row+in+acce&gs_l=serp.1.0.0i22i30k1l5.78841.84680.0.87612.21.18.0.3.3.0.201.2215.0j17j1.18.0....0...1c.1.64.serp..0.21.2236...0j35i39k1j0i67k1j0i19k1j0i22i30i19k1j0i22i10i30k1.j-WWiVBpoZA
First result: https://www.mrexcel.com/forum/microsoft-access/631352-add-record-excel-visual-basic-applications-form-access-db.html

Now run a query to process the data. The query can call a VBA routine if the processing is too complex.
Google: https://www.google.de/search?sourceid=chrome-psyapi2&rlz=1C1MDNE_deDE712DE712&ion=1&espv=2&ie=UTF-8&q=vba%20excel%20run%20query%20in%20access&oq=vba%20excel%20run%20query&aqs=chrome.1.69i57j0l5.9422j0j8
First result: http://stackoverflow.com/questions/14399672/execute-query-from-access-via-excel-query-in-vba

Keep in mind that Access DB opened via "connection strings" will be closed immediately after the call, unlike other applications (eg Excel) that stay open until they are actively closed.
Google: https://www.google.de/search?newwindow=1&safe=off&rlz=1C1MDNE_deDE712DE712&espv=2&q=vba+connection+string+access&oq=vba+conne&gs_l=serp.1.0.35i39k1j0l5j0i22i30k1l4.463944.464933.0.467082.5.5.0.0.0.0.164.512.0j4.4.0....0...1c.1.64.serp..1.4.509...0i67k1.wY2Em-mz5Wc

HTH,
Y.
Yacine

wapperdude

I used this search criteria, which I think is nearly identical to one of Yacine's searches:  visio vba add record access database

Many results, this one I selected because it's by David Parker, long time Visio expert:  https://blog.bvisual.net/2015/09/16/linking-an-access-web-database-to-visio/

You may want to tweak the search criteria to focus more specifically to your needs.  I don't do database stuff, but based upon Yacine's results and my initial search, it seems promising.

Wapperdude
Visio 2019 Pro

Nikolay

It looks like davidgon already has a form (application, basically) developed in Access.
Now he wants to make that form available in Visio. So that when you e.g. click a button in visio, you get that access form in Visio.
davidgon, please correct me if I am wrong.

Think of Remote Desktop/Remote App for example - you can have a window from a completely different system on your desktop, integrated and acting as if the app was running right on your computer.
Unfortunately, in case of Access/Visio, there is nothing like that. You cannot transparently "borrow" a child window from another desktop application and make it part of your application...
At least, I'm not aware of any technology that can make it happen (apart from unicorn magic)

Croc

#11
QuoteYou cannot transparently "borrow" a child window from another desktop application
Why?
In the way that I have shown, the user sees only the form.
The invisible application and visible form.

Yacine

@all,
I recon that my explanation missed the most important point. Namely the issue of remote controlling an access form.
There may be scenarios where this makes sence. In Davidgon's it doesn't. I think (from his description) that he just needed to think the solution one step further - execute the data processing by invoking directly the routines involved (vba and/or queries) instead of trying to mimic user's behaviour in a form.

@Croc: nice.
Yacine

Nikolay

Quote from: Croc on January 28, 2017, 06:17:22 PM
QuoteYou cannot transparently "borrow" a child window from another desktop application
Why?
In the way that I have shown, the user sees only the form.
The invisible application and visible form.

I thought that Access main window still will be visible, because form is a child window of the access window.. and one cannot hide parent window, while keeping one of it's child windows visible.
If it's not like that then it's exactly what the topicstarter is after!

davidgon

Thanks to everyone!

For what I have read, I think I won't be able to use my Access form in Visio (I could, but the Access parent window will be on too, isn't it?) . But I think I can make a form in Visio with the same behaviour that the other one. As soon as I get the solution I will post it!