Default to VBA NOT Embedded Macro
I hope someone has some good news about making Access 2007 default to use VBA not embedded macros .
Thank you for taking the time to report an issue.
What's wrong... Please write below.
I have been looking over a customer order db that the programmer doesn't't use any Embedded Macro's. Everything is in VBA. I use Embedded Macro's on all my cmdButtons. Whatis the advantage to not using Embedded Macro's.
In Microsoft Office Access 2007, macros can be contained in macro objects (sometimes called standalone macros), or they can be embedded into the event properties of forms, reports, or controls. Embedded macros become part of the object or control in which they are embedded. Macro objects are visible in the Navigation Pane, under Macros; embedded macros are not.
In an embedded macro, is it possible to use a TempVar to store a DAO.RecordSet or DAO.QueryDef? Or otherwise, is there another way to use a Recordset or QueryDef in an Embedded Macro?
For example, say I have a Table (called myTable), that has 2 fields, ID, myFieldA. I want to make a Form that has an Unbound text box (say, boxA). Then, I want to make an Embedded Macro that queries myTable, using ID as the criteria field, so that the query would return only one record.
The Macro would then temporarily store the RecordSet, so that it would populate thetextbox, boxA, with the value of myFieldA from the query.
I know about binding boxA to myFieldA. I also know how to do this using VBA. But for my purposes here, I want to keep all of the form elements Unbound, and drive the user interface with queries, using only Embedded Macros.
Then I could use smarter logic for doing things such as validating that the user fills in required boxes before writing records to the table, verifying that the user intends to save changes, etc.
(I've had enough pain dealing with Access' clunky BeforeUpdate and AfterUpdate events).
In using this new version of Access, I have found that when creating buttons, Access no longer uses vba codebehind to handle all the dirty work - rather, it seems Microsoft is forcing me to use the upgraded (and very nice I must say) Macro builder.
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?
Does anyone know a good way of testing embedded macros?
When you are building or reviewing the macro, Access does not permit access to any other part of your database and there are lots of reasons why it would be nice to have that ability.
The only help I have found is to have the VB window open so I can check the value of variables and test expressions while I'm building the macro conditions
I have an embedded macro in a Close Form Button. The macro is used to run some VBA code to check that the form has been completed correctly. The macro sets a Temp Var so the the code knowsthat it was instigated by the Close Button.
This macro has been working fine until I added an additional sub form (with no connection to the macro) to the form then the macro was failing with the message:
"The command or action RemoveTempVar isn't available now" when you click ok it opens the macro failed message box.
I am having lapse in memory. I know that you can change the default when you use the Access Wizard in 2007 to have it create the action in VBA versus the Macro default. I just cannot recall where this is located to make the change. I also thought the I had made this change on a global basis but recently opened a new data base and found that it was creating simple wizard commands embedding macros. I know how to convert them, but much prefer that they be created in VBA
I created a form and added a button with the embedded Macro that prints the current record only. The macro arguments a select record, print record. My problem is that it prints the record in portrait. I need it to print landscape. How do I change it from portrait to landscape?
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.
When I use a form wizard in Access 2010 and create a button, it defaults to creating a macro to perform that button's action. How can I change this so it never creates a macro but it builts VBA