Topics Search

How To Use Application.run

How To Use Application.run
Views: 1
I found a database that shows you how to create a menu for the side of your form. I altered the code to allow sub-sub menus and have ran into a problem (that would have occurred even with the code unaltered). When I want to run code (which the procedure name) is stored in a table.

Case 3
strCode = Me.CodeToRun
Application.Run strCode

I select what action type I want to perform (3 is to run code) and it works as long as I don't have to pass along a variable such as if I wanted to call this function:

Function closeMe(Optional pF As Form) As Byte

I am not sure how I can alter this to allow me to call functions/subs that have more than just a "name" that can be a string.

Hope I explained this good enough to get some assistance to point me in the right dirrection.
Sponsored Links:

More topics

 

Run procedure on application shut down

Preview
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

Preview
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

Preview
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

Preview
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

Preview
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??

Preview
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
 

Run Access Sub Routine from Excel

Preview
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
 

Control Access application through Web site

Preview
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
 

Handle Run-Time Errors in VBA

Preview
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.
 

Can I Create an EXE from my Access Application?

Preview
There is no way to create an EXE from an Access database. However, there is a way to install what's known as the "Access Run-time engine" that will allow the user to run the app without having Access installed on their system. The Run-Time is NOT the same as an EXE. For one thing, anyone who has Access on their system will still be able to open the application in their copy of Access (assuming they have the right version).