Return macro name from a table in VBA
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.
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
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.
'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.
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.
I'm still relativly new to programming in vba but as far as I know you can't call a vba functional from outside the database. What I'm hoping for is some way I can select all from the function and have the function return a table, the same as table valued functions in MSSQL. e.g. SELECT * FROM myFunction()
Is this possible in assess? what would I need to do to my function to have it populate and return a table? I'm not trying to be spoon feed here, I'm just a little lost for direction. If someone can point me the right way I'm happy to do more resarch myself.
This is fine for all the simple tasks, but what I have myself into is a little more complex than the Macro builder is ready tohandle I think.
Before, when I created a button, not a Macro. I am trying to build the following button types:
Button 1 - Update a Field in a table, Save form, Close form
Button 2 - Update a field in a table, save form, new record
Button 3 - Update a field in a table, save form, print report, close form . and so on and so forth.
I used to put 3 or 4 buttons on the form, then copy and paste the generated vba in the correct order in a single button, and delete the dummy buttons. But now it seems as the basicfunctions are built using an embedded macro, and when that is combined with VBA, Access must choose between one or the other, rendering my button useless.
Is there a setting in 2010 that will change the way buttons are created in that VBA is used by default instead of macros?