
STATUS BAR ACCESS DEFINED WINDOWS
Select settings for how object windows appearĮnable the use of Access keyboard shortcuts What do you want to do?Ĭustomize options for your current database This posting is provided "AS IS" with no warranties, and confers no rights.Note: This article doesn’t apply to Access web apps – the kind of database you design with Access and publish online. SDET II - Access Test Team - Microsoft CorporationĪuthor - Microsoft Access 2010 Inside OutĬo-author - Microsoft Office Access 2007 Inside Out Jeff Conrad - Access Junkie - MVP Alumnus There is also lots of extra material that serves as reference material, such as expressions, macros actions, etc. For example, data macros are covered in Chapter 7. However, the chapters are organized such that you can zero in on the specific topics and features you'd like to learn more about. My book is designed to cover just everything so as such, it is a pretty hefty book. If you do, I'm sure you'll find lots of valuable information to assist with growing your general Access knowledge, as well as specific 2010 features. In case you're curious, here is how you can make it work in the AfterUpdate, *but* I don't recommend it and it won't cover new records. So as already mentioned, use the BeforeChange event as suggested by the other responders. Utilize this log table when debugging and working with your data macros. This was the late change we made to the product for the AfterUpdate event. "EditRecord failed because the default alias represents a record which is read only." If you look at your original error, you would have seen this text: Click the button labeled "View Application Log Table" in the Backstage view. You can also open this table from the Backstage View. If you click those words in the Status Bar, Access opens this log table where you can examine the errors. This means Access ran into one or more problems executing your logic. When running your original tests, you should see the words "New Application Errors" displayed in the Status Bar. One debugging tool you should really take advantage of with data macros is the USysApplicationLog table. Why? As written, if you just had this logic in the AfterUpdate event, your salary field won't get updated when you enter a new record. For your scenario, you would also have to write some duplicate logic in the AfterInsert or BeforeChange to do the same thing. So in order to prevent the data macro recursion loop, you would have to use the "Updated" function to determine if the Dept field has changed so it doesn't keep running the same AfterUpdate event over and over again.ģ. Access repeats this loop for 10 times and then bombs out (stops any more loops) because it will be a never ending cycle. AfterUpdate fires yet again and again and again. Why? Well you just had it change the Salary field remember? Salary field gets written again based on your logic and record is saved for a third time. Access looks at Dept field and writes the value you want to Salary field. For example, if you do your scenario in the AfterUpdate event, here's what would happen if you weren't paying attention to your logic: You're way more likely to fall into the trap of data macro recursion - the data macro logic running over and over again. With BeforeChange, you can do this type of checking and editing all at once and make one record save instead of two.Ģ. That's two passes on the same record when one is more efficient.

STATUS BAR ACCESS DEFINED UPDATE
If you use the AfterUpdate event, you have to commit your record changes (the Dept change) and then you're asking Access to go change the same record yet *again* and update the Salary field. So is it possible to use AfterUpdate for this? Yes it is, but I don't recommend it for several reasons.ġ. If you need to edit some data in the *same* record based on values in other fields in the same record, you really should use the BeforeChange event.Įssentially in your case you want to change the value of the Salary field based on what Department is entered. Here's a good rule of thumb that will be easy to remember: Based on what you are trying to do, you really should be using the BeforeChange event instead of the AfterUpdate event for data macros. Here is some information which I hope will help you understand what is going on. It's very possible that Lynda was using an older Beta version of the product and the specific example will not work in the released Access 2010 product.īack to your questions concerning this space. We actually made a late change to the product in this specific area of data macros during the Beta phases. I'm not familiar with the video you mention, but I believe it could be incorrect depending upon how the information was presented.
