Topics Search

Run vba code from within 2010 Data Macro

Run vba code from within 2010 Data Macro
Views: 61
Is it possilbe to run a VBA function from within a 2010 Data Macro.

I have a function called WhoAmI with returns the Id of the user

I want to run this function from within the data macro
Sponsored Links:

More topics


How to you tell Access 2010 to run VBA code?

I started with creating a Macro in Access 2010 which is very repetitious (open a query, update and close. move to next query). I used the Macro builder to make sure I got the right code commands and then converted to VBA because it is my understanding running code is better than running a macro (but I still haven't seen anything thatexplains to me why that is so).

2010 VBA "do while" code in a macro

In Access 2010, want to run perform a "do while" loop in a macro. I understand VBA is the way to do this. So, I think I want to run a VBA script in a macro.

This Macro runs against a Form that has a SubFrom (MainForm named "Expense ID" & SubForm, "Expense"). Macro is initiated by pressing a button.

I would like help with some VBA code showing how to perform the following:

1. Evaluate a field ("Activity") in the first record of Subform ("Expense") against condition "Is not Null".

2. If condition is true, set value of another field ("Post") in the same SubForm record to "1".

3. Move to next record and repeat steps 1 & 2 until all Subform records are evaluated.

4. Return to macro that initiated the VBA script to perform the next action in the macro.

Run a converted Macro

I am a beginner in Access VBA. I have created a macro in access to run a make table query and then rename the table. Now I want the current date to be part of the renamed table.
So, I converted the Macro to VBA and then put the date field in the code. When I run it from the VBA editor, using F5, it runs great and produced the right output. But, when I run the original macro, it is still creating the hard coded name as in the macro.

I want to know, how to run the converted macro, without having to go into the VBA editor mode

run VBA code in Macro

Is it possible to run VBA code within a macro?
What I want to do is run one macro for certain days of the week and another macro for other days of the week. I could just stick the code in the button on the switchboard but I could see an overzealous user changing the switchboard and then the code is gone. I like the idea of the code within the macro itself so someone not familiar with VBA could alter it.

I tried putting something like
If Me.Today = "Monday" Then
DoCmd.RunMacro "Macro2"
ElseIf Me.Today = "Thursday" Then DoCmd.RunMacro "Macro2"
Else: DoCmd.RunMacro "Macro3"
End If

In the RunCode action of the Macro with no success.
I'm sure there is an easy fix, but I'm not seeing it.

Access 2010 now creates macros instead of VBA code

I have been using 2003 for a while but I have switched to 2010 recently.

I have just found out that if you use the wizards when creating a command button, Access now creates a macro instead of creating VBA code (for opening a form, for example)

I prefer code over macros, so is there a way to change this?

Also, what about the macros that have already been created? How can those be converted to VBA?.When I use the "Convert From's Macors to Visual Basic" option I get a "There was a problem opening the macro "[Embeded Macro]". Do you want to continue?" and the macro does not get converted

Run a Embedded Macro from VBA Code

I am trying to rerun an embedded macro which is attached to the AfterUpdate event of a combobox. Is there anyway of rerunning this query from VBA Code?

I have tried using:


However it says you need to insert the Macro name however I do not know what the embedded macro is called in order to refer to it

Running Code based on User's Response to delete macro

I am using the standard delete macro that the access button creator has. I added a line to the macro that runs a vba code segment, but I only want this to run if the user presses yes to deleting the record. Is there a condition that I can write that will allow me to determine if the user pressed yes or no and run the code accordingly?

Access 2010 Macro

I have an MS Access 2010 Database that will be run @ 6:00 AM Automatically. The Autoexec Macro has been created. the purpose of the Macro is to update a local table with data from SQL Server. In previous versions of Access I used setwarnings = off to accomplish this without user intervention. However in MS Access 2010 I don't find that option. Anybody know where it is or how I can accomplish this

VBA to get value from combobox to run a macro

How can I get vba to do this.

When I click a button on the main form the vba code will execute and get the value from the combobox ie TE4700 and locate the macro with the same name ie TE4700 with reports in then it willrun the macro and print off the reports.

how to use or run access vba code in access 2007?

We press alt+f11 then insert >> module. To run that, view >> macro >> runmacro >> refreshpt something.

similarly in access I wonder how to run vba codes. there is one option called vba in database menu in (access 2007). I clicked that and inserted modules and saved. Now I don't know how to run it in a table or query.