Related Topics

How To Use Application.run

Run procedure on application shut down
I need to run a clean up procedure when the user closes the application.
I have created a toolbar control, which allows the user to close the application, and have the procedure tied up to this. This works fine.

But I have been unable to make it run if the user chooses to close the application by clicking the 'Close' button in the upper right corner.

My question is if there is an 'application_close' event (or similar) which I can use to run my clean up code, or if I (as an alternatively solution) can disable the 'Close' button


Run Ms Access Application on any PC
I just developed a Ms Access Application and I'm interested in making it run on any PC with Access installed.

The issue I have is that there are some VBA codes in my application which refer to paths and paths vary from PC to PC.

For instance, a VBA code for my application could be Application.followhyperlink "C:/Users/Jack/Desktop/trial.xls" while the same line of code could be
Application.followhyperlink "C:/Users/Sam/Desktop/trial.xls" on another PC

Is there a way I can create a general path for this line of code that will run on any PC?


Opening Access causes vba to open
So when I open the access application like an end-user would (not holding down shift), VBA automatically opens and the yellow arrow is pointing to the Private Sub Form_Load() method in the first form. I have looked through all of the menu options, but I cannot figure out how to disable this yellow arrow. If I run the play button in VBA, the application will run but I need to turn this yellow arrow off so that we can deploy the application back to the end users. Everytime I close and re-run the application, I am experiencing the same issues. Has anyone else experienced this behavior before? Any comments are appreciated.


AutoExec Macro Doesn't run
I have created an autoexec macro that runs just fine when I open access directly. However, when the .mdb is accessed by another application (.ldb placed on file and the access program itself isn't run) the macro does not run.

Is there a trick to this? How do I get the macro to run even if the MDB is open by another application?


How to quit Excel from Access
I have sucesfully called and ran a Excel VBA macro from Access. I can't get Excel closed, and even though the macro runs, I get a

Run time error "404" Methog "run" of object _Application failed.

I have put "Excel.application.quit" at the end of the Marco.

Code I'm using:

Sub readMim22()

Dim xlsApp As Excel.Application
Dim xlswkb As Excel.Workbook
' Set xlsApp = CreateObject("Excel.application")
Set xlsApp = New Excel.Application
Set xlswkb = GetObject("M:\Terry\201005_LIM MISO Data\Get LIM MISO Data_052810_tab.xls")

Excel.Application.Visible = True

xlswkb.Application.Run ("ReadMIM") (get error this stmt)

Set xlsApp = Nothing
Set xlswkb = Nothing


Show results not using join??
I have 2 tables, one tbl_Application contains details of applications, tbl_A_Numbers contains details of account numbers for that application. I want to run a query which puts all the records from tbl_A_Numbers into one column, rather than the conventional link.

So, I have APplication 1, 1234,1235,1236

rather than

Application 1, 1234
Application 1, 1235
Application 1, 1236

and so on.

Is this possible, just in SQL?

I have tried using (Select A_Number from tbl_A_Numbers where A_Number.Application_ID=tbl_A_Numbers.Application_ ID) and it doesnt work


Control Access application through Web site
I have developed an Access application which is installed on client pcs. I need to be able to control whether an Access application on a client's pc runs or not and I sometimes need to take this decision based on unforseen events, like abuse of application etc.

Assuming connection to the Internet for the client pc, I thought of having the application communicate stealthily with a Web site and depending on some value on the Web site to take appropriate action such as prevent user from running the software.

The application can sense whether or not it is connected to the Internet and can even send text messages.

On the specific Web site, I may have a table (hidden) with two columns, the user license id and a boolean indicating whether the user is allowed to run the application or not


Run Access Sub Routine from Excel
I have an Access Db Module on another computer that contains a Sub Routine I would like to execute from Excel. How can I execute the routine and have it open and run on the host computer from an Excel workbook on my computer? I tried the code below but ran into two problems (1.) It opens the Access DB on my computer instead of the Host (2.) the appAccess.Run command didn't run the sub routine in Access

Sub RunAccessSub()
Dim appAccess As Access.Application
' Create instance of Access Application object. Set appAccess = CreateObject("Access.Application")
' Open WizCode database in Microsoft Access window.
appAccess.OpenCurrentDatabase "B:\Documents and Settings\bconner\Desktop\Template Month End Reports v1.2.mdb", False
' Run Sub procedure.
appAccess.Run "MonthEndReports" Set appAccess = Nothing


Handle Run-Time Errors in VBA
When you are programming an application, you need to consider what happens when an error occurs. An error can occur in your application for one of two of reasons. First, some condition at the time the application is running makes otherwise valid code fail. For example, if your code attempts to open a table that the user has deleted, an error occurs. Second, your code may contain improper logic that prevents it from doing what you intended. For example, an error occurs if your code attempts to divide a value by zero. Learn how to trap run-time errors.


How can I run my application while in design view on a form? or while in development mode?
I want to run my application (form) from design view area after I make a mod. If I open the form it appears to work for the form however many features don't work. Can I run the app from the beginning without having to exit developer mode? I currently exit and start Access without going into developer mode. thanks shash


Access 2003 Application using Access 2010
I developed a front end /back end Access 2000 application (using Access 2003) some time ago for a friend that runs a small local business.

On my desktop I have Access 2003 installed and on my laptop I have Access 2007 installed. Both machines have Windows 7.

My problem is that my friend's PC has a fault and he has replaced it with a new Windows 7 PC and Office 2010.

I don't have Office 2010.
He wants the Access application to run on his new PC (with no extra features).

What's the best way to deal with this?
I can't borrow his PC as it is heavily used.
I had thought about converting the application to Access 2007 in the hope that Access 2010 will run it- Would this work?


How to avoid updating linked tables every time
I have an Access 2003 application with some linked tables which are configured to use an ODBC datasource.

When I wanted to run this application on my PC the first time, I created the odbc data source on my machine and updated all tables to use this data source. The problem is that I have to do this every time I start the application.

How can I do this one time, and make the application remember it


Runtime Problem
I've been working on a database for 2 months with no problems. for the first time, I got an error message which read: "Execution of this application has stopped due to a run-time error. The application can't continue and will be shut down." I have never seen this message before and I have no idea what is causing it. Do I just need to reinstall the run-time engine?


Error 429 occurs only when run via Citrix
I have distilled this problem down to a one-line program. If I create an application with one form, and put the following code in the Form_Load event:

Dim objOutlook as Outlook.Application
Set objOutlook = CreateObject("Outlook.Application")

I have included a reference to the Microsoft Outlook 11.0 Object Library. And I've set the form to open up during the application Startup.

And that's all I need to reproduce the problem. The database runs fine on our Windows Server 2003. But as soon as I try to run it via Citrix, it fails with "run-time error '429': ActiveX component can't create object".

Citrix is supposed to act as a terminal server, just passing the screen display through to the client, so I don't understand how it can do anything differently to running direct on the server.

I'd really appreciate your advice, expertise on running Access through Citrix, or


set Library References at Startup
Is is possible to set my library references at Application Startup?
I have an application that needs to run on a 2003 platform and a 2007 platform.
The application refers to Word and Excel libraries.
I'd prefer not to use a macro to do this.


Accessing my inventory remotely
I have a simple Inventory application (developed using Access 2000) which is stand alone. That is the changes to the inventory can be done only on a single PC.
Now, I need to make it available from different geographical locations i.e. via internet. However, it will be accessed from one location/one user at a time. My inventory application requires Access 2000 to run.
Is there any way that I can upload Access 2000, my inventory application and associated folders to a remote 24/7 Server and access it at will. What is the simplest way to do this


Mapping network drive
I have a smal Access application that works in the network. When some users try run application received error that network drive is disconect. Therfore I would like put for application some VBA code that establish network connection to specific drive. something like this

Set WshNetwork = CreateObject("WScript.Network") On Error Resume Next WshNetwork.RemoveNetworkDrive "X:", True On Error GoTo 0 WshNetwork.MapNetworkDrive "X:", "\\p00002apl\vba" 'HardDrive" Set WshNetwork = Nothing

Where I should put this code to run "before" open application? (I using this code in excel in 'Workbook_Open', but for access I have no idea where should be put to work


Running excel macro from access
I am running excel macro from access , everything goes almoust fine but after the excel macro has runned there goes an Run-time error 440 Automation error in Access VBA an it stop marked red bellow , wha goes wrong ?

Private Sub Command35_Click()
Dim XLApp As Object
' Open the XLS fle, make it visible, get control and run a macro called muotoilu
Set XLApp = CreateObject("Excel.Application")
With XLApp
.Application.Visible = True
.UserControl = True
.Workbooks.Open "thy2.xls" "After opening excel macro it make some settings and save and close the excel file"
.Application.Run "muotoilu"


Basics for Building Access 2007 Runtime-Based Solutions
Find out how to prepare your application for use with the Microsoft Office Access 2007 Runtime. If you are creating an application that runs in an Access Runtime environment, you must carefully consider how to provide an interface for the user. You must also consider the fact that some users may own the correct version of Access and run the application in a full Access environment. Take care to test your application under both environments to make sure it properly balances usability in the Access Runtime environment with code security in a full Access environment.
After you create and test your application, you can use the Package Solution Wizard that is included in the Access 2007 Developer Extensions to create a final version that you can deploy to end users.


Acces connection error in Windows 7
I created an vb.net Application with microsoft visual studio 2008 and Access 2003 as Database.

The application work fine in XP O/s but when I run the application in Windows 7 it gives error when connecting to Database.

It works fine when I create an new Access 2003 database in Window 7. It gives error System.Data.OleDb.OleDbException: Operation must use an updateable query.