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 Replies


ADVERTISEMENT

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

Msg Box Before Macro Start

Dec 14, 2005

Hello,

I have a button that runs a macro to delete records in 12 tables. I want to create a message box before that macro runs warning that you are deleting records in 12 tables and are your sure you want to run the macro.

I need a message box with an ok and cancel button. Where do I put the msgbox funtion in this code?

Thanks !!

This is my code:

Private Sub cmdRunDeleteMacro_Click()
On Error GoTo Err_cmdRunDeleteMacro_Click

Dim stDocName As String

stDocName = "mcrSemesterStartRecordDELETE"
DoCmd.RunMacro stDocName

Exit_cmdRunDeleteMacro_Click:
Exit Sub

Err_cmdRunDeleteMacro_Click:
MsgBox Err.Description
Resume Exit_cmdRunDeleteMacro_Click

End Sub

View 5 Replies View Related

Start Up MS Access From Vb And Bypass Startup Macro

Jun 14, 2012

I know that I can startup MS-Access manually and bypass the startup options, including any macro that is set to run automatically, by holding the Shift key down when launching the application. I have:

Code:
Public Sub AccessStuff()
Dim myaccess As New Access.Application
myaccess.OpenCurrentDatabase(" orfs006slsops_repts\_RS DevSOPSOP.MDB")
Dim db = myaccess.CurrentDb()
End Sub

which works nicely and opens the database just fine. However, this mdb has a startup macro defined in it. I can't hold down the Shift key since I'm doing this from a program. In this case, how can I bypass the startup macro?

View 7 Replies View Related

General :: How To Write A Macro To Display Only Grouped Items In Excel

Dec 11, 2013

I'd like to use a macro to display only those items which stay as a group in "Old Project Code" (black font) and filter out those which are singles in "Old Project Code" (red font) as shown below extracted out from a worksheet called "Project" in Excel.

New_Project_Code Old_Project_Code
62409 AU028
62410 SAU029
62411 ZZZ001
62963 ZZZ010
62964 ZZZ010
62965 ZZZ010
62966 ZZZ010
62967 ZZZ010
62412 ZZZ050
62973 ZZZ061
62974 ZZZ061
62975 ZZZ061

1. The color wasn't there in original sheet. It is here only for demo purpose.
2. Data are changing dynamically, so need a macro in place to catch a snapshot at the time of macro is firing.

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 :: 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 :: 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 4 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 :: 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

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 :: Public Function To Assign A Macro To All Buttons With A Certain Name

Jan 23, 2014

I have built an access application that contains a set of buttons along the top of every form that serve as navigation.* These buttons each perform the same function on every form they are on. (menu opens the main menu, etc) I have database macros to assign each button the same function but I still have to go through each form and manually assign them. I was wondering if it was possible to define a public function that on db open will look for all buttons with a certain name and assign them the macro. (so all buttons called cmdmainmenu will have the OpenMainMenu macro assigned and so on).Before you go there, I have already tried the navigation form and set all forms as subforms.

View 5 Replies View Related

Modules & VBA :: Stop Macro Error If There Is No Data To Find?

Jul 16, 2015

I completed the Op[en form and find specific data wizard and it works.

Here is my issue: If there is no data to find, I get a "Stop Macro" error.

How to change this?

View 1 Replies View Related

Modules & VBA :: How To Print Specific Report With PrintObject In Macro

Feb 13, 2015

Actually I need to select printer before printing report. That's why I need to call printer dialog to select printer using "PrintObject" in macro. But it's print the form not report. I need to print a specific report.

View 1 Replies View Related

Modules & VBA :: Operate Macro On Multiple Files In A Directory

Jul 21, 2015

I have contract notes files in .xls format towards sale of equity shares from the brokerages. I have to do some editing in these files like deleting some rows, adjusting width of columns and inserting date of contract.

a) Contract-A.xls shows original file.
b) Contract-B.xls shows modified file
c) VBA macro code used for deleting rows and modifying column width is shown in modify_contractnotes.xlsm file.
d) Presently I open the file and copy and paste the contents on the macro-enabled workbook sheet . After macro operation I transfer back the contents by copy and paste to a master file(Contract-C.xlsx) and clear the contents in the macro enabled workbook to make it ready for another operation.
e) It is time consuming process for around 60 files per month.
f)After this operation I run RDBMerge add-in to consolidate and normalize all these files in a directory. RDBMerge smoothened out merged cells also.

Is it possible to have a macro-enabled workbook open all the time and the contract files be opened one after other and macro contained in macro enabled workbook by modifying its code suitably operate on these contract files.

Files are attached in modify_contractnotes zipped folder.

View 4 Replies View Related

Modules & VBA :: Scheduled Task - Run Macro To Send Report Out?

Feb 3, 2014

I have a report that I run manually from my computer every day.

This report is created by a macro in microsoft access, then it runs a VBA macro to send it out..

Is there a way that I can add this as a scheduled task since I usually forget to send it out?

View 3 Replies View Related

Modules & VBA :: Use Macro Button To Pass Query Results To Listbox

Sep 30, 2013

Is it possible to have a macro button to pass query results to a listbox? I have a database where I have some fields with dates. What I need to do is to show a list of all cases that have a start date (and also the end date). So I will have 2 buttons, one that says "show started cases" and second one "show closed cases". If I press the first button, it will run a query and show only those cases that have a date filled in the started case field. I made a button that shows the results in a report, but I would like to have it show up in a listbox so I can double click it and go straight to the case.

View 14 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 :: Document Could Not Be Registered / Unable To Open Macro Storage

Oct 31, 2013

I have a VBA program which is stored in an Access database. The program creates letters using Word template documents as well as new Excel sheets. When one of the users in my team undertakes this process she is unable to create the files (although she could before). The following error message occurs initially for the word documents:

"The document could not be registered word 2010. It will not be possible to create links from other documents to the document"

When I enter debug and attempt to run the code again the file opens but subroutine halts again and I get a different message:

"Could not open Macro storage"

The line of code which is identified for both errors is:

Set wdDoc = wdApp.Documents.Open(TemplateLocation)

Where wdDoc is the a Word.Document, wdApp is a Word.Application and TemplateLocation is the path for the template

I have already checked the following:

- 'Trust access to the VBA project object model' in the Trust centre is ticked and Macro Security is set to none.
- DCOM Server Process Launcher is set to automatic in Services (Local)

View 1 Replies View Related

Modules & VBA :: Password Parameter For Import / Export Data Macro

Jul 16, 2014

I am creating a ImportExportData macro that will link to my tables in the BE

However the BE has a password. I was told this would require coding.

I have even tried to 'convert macro to VB' and i get this:

Code:
DoCmd.TransferDatabase acLink, "Microsoft Access", "c: est.accdb", acTable, "Table1", "Table1", False

I then tried to enter the password in the last segment (StoreLogin) ie:

Code:
DoCmd.TransferDatabase acLink, "Microsoft Access", "c: est.accdb", acTable, "Table1", "Table1", False, "PASSWORD"

but that didn't work either, i got a "An expresiions you entered is the wrong data type for one of the arguments"...

View 2 Replies View Related

Modules & VBA :: To Check If Excel Files Are Updated Today Then Run A Macro

Jun 26, 2015

I have a database which I've creating but now want to make others available to update - in the past this has not gone well! The database uses data from two excel sheets and the problem has been people do not always check if these have been updated today before running and therefore the database gets loaded with old data.I have found code that will check and display a message showing datelastmodified for a file but what i'm trying to find is code which will check both files' datelast modified, if they are modified today then run the update macro, if one or both are not modified today, then to display a message saying that the excel is not updated.

View 7 Replies View Related

Modules & VBA :: Creating EXE Or BATCH File That Executes Specific Excel Macro?

Jan 27, 2015

Is there a way to create some sort of an EXE or BATCH file in any Windows Explorer folder, that executes me a specific Excel Macro?

My problem is that I got several files split up by Departments, updated every day.

So far I have to open each file and update the format.

It would make my life much more easier if I could just run a file that opens each file and applies a format to them.

View 1 Replies View Related







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