Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dl dl is offline
external usenet poster
 
Posts: 6
Default Open Access Form from Excel Macro

I've researched strategies for this for the last couple days and the usual
method seems to be many lines of vb, which in my situation didn't seem to
keep the form open or just didn't work. It would open the db and the form,
but they would then close immediately. The solution I ended up using
couldn't be simpler.

Sub whatever()

Dim RUN_IT

'''Opens Access exe file, then your DB, then the macro that will open the
form, with visible argument=1, which keeps it open'''

RUN_IT = Shell("""C:\Program Files\Access 2000\Office\msaccess.exe""
""C:\DatabaseWithMacroToOpenForm.mdb"" /x ""name of the macro""", 1)

End Sub

The magic is that ", 1" at the end of the Shell command which tells Access
to stay open. A zero there would cause it to close after the macro was run.

All you have to do is then put a command button on the form that when
clicked closes the Form and the Macro, followed by a Quit / SaveAll step.

Note: You may know this, but if you don't include a quit step at the end of
the macro an instance of MSACCESS.exe will stay running in the background
(only seen in task manager) which leaves an entry in the ldb file causing the
db to stay locked.

Btw, killing the extra MSACCESS.exe in task manager that results from a db
closing unexpectedly, which leaves the ldb file and won't allow you to have
exclusive access -killing that will free it up again. Just figured that out
the other day. Used to have to copy it /rename it before I found that.

I just wanted to share since I've found so much value in all the information
everyone on this group supplies. Thank you all. Hope this is helpful to
someone.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open Access form from excel hyperlink JCanyoneer Excel Programming 1 July 7th 06 06:56 PM
Open Excel using Access macro No Name Excel Programming 2 March 7th 06 04:18 PM
How do I open an Access file with a macro in Excel? gaitkeeper Excel Programming 1 May 26th 05 10:06 PM
How do I invoke a MS access form from an Excel Macro Jim Gabriel Excel Programming 0 May 18th 05 09:00 PM
Open Ms Access database with excel macro Sani Excel Programming 2 November 19th 03 06:06 AM


All times are GMT +1. The time now is 05:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"