Return macro name from a table in VBA
I am builing a reporting database where I have a form(Report Dashboard) that has an unbound control where the control source is a table (Reports) and reflects the report name from the table. The table has the report name and another field called Trigger that has the name of the macro to run. When user selects the Report Name from the unbound control (ie on click) I am trying to build a VBA code that runs the macro in the field Trigger from the Reports table. Here is what I have cobbled together but I get an compile error stating "object required" on my set command for strMacro.
Private Sub lstReports_Click()
Dim myDb As DAO.Database
Dim strMacro As String
Set myDb = CurrentDb()
Set strMacro = myDb.OpenRecordset("SELECT Trigger FROM Reports")
On Error GoTo strTrigger_Error
MsgBox "An error has occured - no associated macro."
Thank you for taking the time to report an issue.
What's wrong... Please write below.
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
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.
I am calling a macro from a ribbon using XML. The macro calls a function to run however I keep getting the following error:
'Return without GoSub'
And then a message pops up. I have put debugger on the first line of the function, but it never gets there -therfore it must be the macro, which is a simply a RunCode macro calling the function.
Macros help to speed up the performance of certain repetitive tasks when using an application. They are used extensively in all office-related software. As a programmer, you can leverage the built-in macro object in MS Access to get a head start in understanding VBA. This article explains how. TOC: Jump Start VBA Skills with MS Access Macros; Creating and running a macro in MS Access: opening the macro designer; Creating the first macro; Converting this macro to VBA code; Creating the second macro.
I am in the process of collating & quantifying customer return data, and have a table that I am entering return information (i.e. Return Date, Return Code (reason for the return), $ of the Return, etc...) What I would like is to compile this data into a table that has the monthly totals based on the Return Code (so, I will end up with one column for each return code). I will then use this table to create a chart (I know how to do the chart, but need help compiling the data).
Have a table (several hundred entries) which must be updated weekly using VBA code. I know how to write the actual VBA code (for each record) but I do not know how/where/what is necessary to open the table, read each record seq and update based on VBA code (function call return value) and to finally close table.
The validation rules use the same logical expressions that can be found typically in criteria of a query and must return a logical value of either TRUE or FALSE in order to accept or reject the value and trigger an exception (validation text property). This simple property is easier to apply than attaching a macro or VBA code to an event which means learning VBA programming!
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
seriously I need help with a table and form. In short I want to know if I can modify a query to return all duplicates but only if it matches a combo box entry if so can I then have the query add the matching data to the same table?
I have a table of customer names and a macro to run a query to find duplicate names from my table after update. I just don't want to keep typing all the details when they are already there basically. So say Mike called and on my form I typed mike into the combo box instead of all the duplicates appear Can I modify it to show only customers called mike?
Oh btw I don't now anything about sql or vba and would be really appreciative of any help given.
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.