Modules & VBA :: Running A Macro From Another Form

Jan 31, 2014

I have 2 forms and a macro in Form1 which runs throught every record to update the records, however.I would like to run this macro from the main form (Form2)

I have tried
docmd.openform "Form1"
Run Macro

but it doesnt work

View Replies


ADVERTISEMENT

Modules & VBA :: Can Manually Stop Auto-Exec Macro From Running By Holding Down Shift Button

Dec 22, 2014

I can manually stop the AutoExec macro from running by holding down the shift button - how do you do it by VBA? I'm opening the db from Excel, and I don't want the Switchboard to display ...

View 1 Replies View Related

Running Queries Using A Macro

Mar 11, 2008

Hi,

Can I use a macro to run multiple queries in sequence?

I searched on this but did not see anything that indicated how to do this.

Any pointers would be appreciated!

Thanks,

Mark

View 1 Replies View Related

Is There A Way To Know What Queries In A Macro Are Running?

May 16, 2006

I've got a Macro that runs well over 100 queries as well as sub-macros. I'd like to know what query the Macro is running. My best solution so far was to create a bunch of forms that open and close with the name of each query, but that's kind of sloppy. I don't think I can use the msgbox because it prompts me to press 'OK' to continue. Any thoughts?

View 2 Replies View Related

Running An Excel Macro From Access

Jun 14, 2004

Hi all,

I was hoping that someone could tell me if it is possible to run an Excel macro from an Access database. I am importing 3 Excel worksheets into Access and this macro needs to be run on all 3 evertime that this file is imported by the user (twice a week). If this can be done could someone please tell me how ??

View 14 Replies View Related

Macro Running Module Failure

Nov 15, 2006

hey there,
i have a macro that has 2 actions:

set warnings to warning on: NO
and
runCode to Function Name: cmdImport_Click()

where cmdImport_Click() is a Private Sub in a module within the same database.

when i try to run the macro i get an error that stated
"the expression you entered has a function name that MS Access can't find."

but if i open the module called ImportMSExcelFile and set my cursor on the Private Sub cmdImport_Click() and select the green arrow to run the procedure it runs fine.

any suggetions?

tuktuk

View 2 Replies View Related

Running A Query / Macro Through Scheduled Task?

Aug 25, 2012

I have a MS Access append query that updates a table from a linked Excel spreadsheet. Im trying to automate the running of the query during the night.

Ive tried a couple of ways to schedule the task with Windows Task Scheduler, although each time, it appears to start the job, but then just hang (task never completes, doesnt run the query or macro and when I log back into Windows, the msaccess.exe process is running).

Methods Ive used are:

- command line with /x macroname

- vbs script which runs the query / macro

Code:
'Read from a Microsoft ACCESS database
Option Explicit
dim oaccess
'execute another Access macro
set oaccess = createobject("access.application")
oaccess.opencurrentdatabase "H:Database.mdb"
oaccess.docmd.setwarnings false
oaccess.DoCmd.RunMacro "Macro1"
oaccess.docmd.setwarnings true
oaccess.closecurrentdatabase
oaccess.quit
set oaccess=nothing
WScript.Quit(0)

- .bat file which just has the command line in it.They all run fine when I am logged in, although it seems to hang when I am logged off the network. I have the correct permissions as Ive scheduled a Excel macro to run and its fine.

View 4 Replies View Related

Queries :: Pop Up Messages When Running Update Query / Macro

Jan 1, 2015

I have 3 different "buttons" on my form that run individual update queries. I know these update queries are running correctly. Decided to make a macro that will allow me to run all these queries by clicking one macro button.

My question is: Is there some way to stop the pop up msg that advises I am about to run an update query and the next pop up msg that informs me of how many rows I am going to update?

These pop up boxes are starting to drive me crazy when I run the macro.

View 5 Replies View Related

Modules & VBA :: Write A More Complex Macro That Will Start Another Macro At Preset Time

Dec 8, 2013

I am trying to write a more complex macro that will start another macro at a preset time, however I am getting stopped at the first hurdle - getting a macro to run another macro.

Here is the code i am using at the moment, all I want to do currently is click the first button, then get the second macro to execute. But no luck, getting error 2157 "cannot find the procedure"

Code:
Private Sub Command3_Click()
MsgBox "1st macro running", vbExclamation, "Note"
Application.Run "teststart1"
' Application.OnTime TimeValue("19:55:00"), "teststart1"

[code]....

View 1 Replies View Related

Modules & VBA :: Run Macro From Other Form?

Jan 22, 2014

I have a form with a button which when pressed need to run a macro which sits on a different form.

i have tried run macro ad do cmd but none of these work.

View 1 Replies View Related

Modules & VBA :: Bring Up Msgbox If Certain Fields Blank And Not Run The Macro In Form

Jan 20, 2015

I have a form with various text, date and combo controls. There is a button at the button that runs a macro (Close NB) at the bottom. What I'm trying to do is bring up a msgbox if certain fields are blank and not run the macro. I only want the macro to run if all the fields specified have data in them.

The fields are :
cmb_cliname
cmb_disease
cmb_projectType
cmb_ProposalStatus

The on click code is:
If (Me.cmb_cliname Is Null) Then
MsgBox "Please fill in the relevant details",
ElseIf (Me.cmb_Disease Is Null) Then
MsgBox "Please fill in the relevant details"

[Code] .....

View 6 Replies View Related

Modules & VBA :: Way Of Looping Through Continuous Form Recordset And Running Update On Each Line?

Jun 11, 2014

i have set up an update query. is there a way of looping through a continuous form record set and running the update on each line?

View 2 Replies View Related

Modules & VBA :: Running Update Query On Record And Have Form Show Updated Record

Jan 26, 2015

i want to be able to create an On Click Event when pushing a command button that will run an Update query to update a record and after it has been updated that specific record will pop up on a Form and be displayed. i know a different way is to run the Update query and then have it displayed in a Select query but i want it to be displayed on a Form instead. is it possible?

View 4 Replies View Related

Modules & VBA :: How To Get Macro Properties

Sep 19, 2013

Using Access 2007:

how to get macro properties using vba? I've attempted something similar to the below to try and divine macro properties:

Code:
Sub MacroDiscovery()
Dim mcr As AccessObject
Dim prop As AccessObjectProperty
For Each mcr In CurrentProject.AllMacros
Debug.Print mcr.Name
For Each prop In mcr.Properties
Debug.Print prop.Name
Debug.Print prop.Value
Next
Next
End Sub

Nothing comes up except the macro names. In my database, I have an AutoExec macro that I have manually added a description to; "This macro auto-executes when the database is opened by virtue of it's name." I can view the description by right-clicking on the macro and choosing 'Object Properties'.

Background:I am attempting to make a universal Access Database documenter for the many, many homemade databases on our network. I'm only interested in certain pieces of information and I would like to make a report to view the information how I want to view it. Thus, I don't care for the built-in documenter--I want to do it my way.

View 3 Replies View Related

Modules & VBA :: Yes / No Action Does Not Halt Macro

Sep 17, 2014

I have inserted a function via a module at the beginning of a Macro using the RunCode action:

Function Msgbox_Yes_No()
Dim Response As Integer
Response = MsgBox(prompt:="Select 'Yes' or 'No'.", Buttons:=vbYesNo)
If Response <> vbYes Then
End If
End Function

However, it doesnt stop the macro from continuing on its way to delete a load of records if the user chooses no.

View 3 Replies View Related

Modules & VBA :: Print Linked Doc From Macro

Jun 17, 2015

I'm working in 2003 (still) and have a macro to print the selected form the user has on their screen. I need this same macro to also print a PDF in a particular network folder or just exit if the PDF doesn't exist. I've tried RunSQL with "PrintDoc [Link2PDF]" as the argument. I've tried RunApp with "Acro Rd32.exe /t [Link2PDF]" as the argument but neither one works. The RunApp line will open the Adobe reader but nothing more.

View 4 Replies View Related

Modules & VBA :: Run A Macro At Specific Time Of Each Day

Dec 9, 2013

I would like to have a macro run at a set time each day. I hoped to use .ontime but apparently that doesn't exist in access.

The macro must run at 10:00am each day, the db will be open from 8:30am until 16:30pm so no problem from that point of view +/- a few mins when the staff arrive.

View 4 Replies View Related

Modules & VBA :: Schedule A Macro To Run At Certain Times Of The Day

Jan 26, 2015

I have a database thats open all day,

I need a macro to run from it at 9pm 12pm and 3pm

Is this possible?

View 1 Replies View Related

No VBA Modules In Access DB Running On OSX

Jan 7, 2013

I have just installed the windows version of Access 2010 on OSX Mountain Lion using a program called Crossover which works very similarly to WINE. I have found that Access will install fine except for VBA form modules and BAS modules, although there seems to be no indication that they did not install as the entire install progresses fine.

I've put together an invoicing program that was created in Access 2010 in Windows but have transferred it over to Access 2010 installed on OSX. It contains a number of forms with code but when I go to VBE, form code modules are not visible. When I try to view the code for a form I get the following error message: "Microsoft Access failed to create the Visual Basic module. If your database is on a network drive, check your network connection, then try again". I was able to insert a BAS module and create a rudimentary VBA subroutine which ran without error so it does seem able to interpret VBA as per normal.

View 2 Replies View Related

Modules & VBA :: Validate Date In Table - Run Macro?

Dec 24, 2013

I am trying to pass a date field from a Form and check if this date already exists within a table if so run this macro.

This is what I have so far...

Private Sub Command38_Click()
If DCount("*", "TblDietPlan", "[MealDate] = <> txtCusDate Then

stDocName = "McrPrint_LabelsWklyCR"
DoCmd.RunMacro stDocName

[Code] ....

View 2 Replies View Related

Modules & VBA :: Simple If Statement Moved To Macro

Jul 29, 2015

I have an open form with buttons to open other forms and use an If statement to position them an example is below.

Code:
Private Sub Command31_Click()
DoCmd.OpenForm "Opener", acNormal
If Me.Frame54 = 1 Then
DoCmd.MoveSize 2500, 1000
ElseIf Me.Frame54 = 2 Then
DoCmd.MoveSize 25500, 1000
End If
End Sub

This works perfectly, however I need to put similar code as a line in a macro and cannot seem to link it.

Code:
Public Function totalmove()
If Forms.Scan_Data.Frame54 = 1 Then
DoCmd.MoveSize 2500, 1000
ElseIf Forms.Scan_Data.Frame54 = 2 Then
DoCmd.MoveSize 24000, 1000
End If
End Function

I get Error 438 object doesn't support this property or method...

View 2 Replies View Related

Modules & VBA :: Macro To Copy Records From One Table To Another

Jun 22, 2015

I have two tables in my Access database, their fields are exactly the same (for now). One table is called Uncheched. The other one is called Checked. So what is need is a macro that takes selected records in table Unchecked and copies them to the end of table Checked. Actually CUTS from Unchecked and PASTES to the end of Checked table.

Sub MoveRecords()
DoCmd.RunCommand acCmdCut
DoCmd.OpenTable "tblChecked", acNormal, acEdit
DoCmd.GoToRecord , , acLast
DoCmd.RunCommand acCmdPaste
End Sub

View 13 Replies View Related

Modules & VBA :: Writing Macro To Duplicate Some Records?

Apr 14, 2014

I have a table it contains a list of opening and closing values along with a date and a couple control fields. What I would like to do is duplicate a few fields from records that meet a criteria onto the same table. After that is done there will be a few updates on the new records. Looking at it, it would be: 'duplicate' where field2 <> 0 and field5 = No and field6 = Yes. All other fields on the newly created records would be their default values.

View 7 Replies View Related

Modules & VBA :: Running SQL From A Subroutine In A Subform?

Feb 23, 2015

I'm trying to run an sql update query (in VBA) to update values in a table, from calculated field values in a subform (using a query as a record source).

Is this possible , and if so, can I call the subroutine from the parent form, and what would be the correct syntax for the VBA sql string (i'm guessing it would be a docmd.runSQL sqlstringname )??

View 1 Replies View Related

Modules & VBA :: Running Total With Criteria Using UDF

Aug 5, 2015

I have determined the solution to my problem lies outside of normal SQL queries and I need to create a UDF.

Here is the problem. I need to create a running total based on the sum of two fields [PTS_ISSUED] & [PTS_REDUCED] with one restriction. The total can never be less than 0. If it is less than zero, the totals reset with [PTS_ISSUED] as the new starting point.

I've attached an excel spreadsheet. Column"C" contains the formula logic I am trying to replicate into access.

I will be honest, writing the UDF is beyond my current knowledge but once I see it I am able to understand it and implement it.

I believe the solution needs to store the running total into a variable, make the necessary comparisons and determine if its okay to add the [PTS_ISSUED and [PTS_REDUCED] to the stored total of the previous calculations then advance. I just have no clue in how to go about writing it.

This calculation needs to be presented in Access because the results will drive several other functions within the database.

View 8 Replies View Related

Modules & VBA :: How To Disable Running Database

Jul 23, 2015

I created a database that uses the "lngEmpName " number to give user permissions , what I need is to be able to disable the running of the database (or main form)and show an error message using vba if I have not logged in for around two weeks is this possible ? if so how and even better a demo would be fantastic.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved