Access opens the code window. I assume the triggers are akin to Access events I really am a newbie at this. Much more robust bc it doesn't force you to use Access security when there's no current need. Note that I have used the Nz Null-to-Zero function because Nulls can cause problems here. Controls as the reference - which happens if you use a Navigation Form.
I would avoid using any spaces in field names! A trigger is a special kind of stored procedure that executes automatically whenever any data-modification statement is used on the specified table. Below is a simple example of creating an audit trail on a Microsoft Access form. Thanking you in advanced, ade I assume you are wanting to identify which record was changed which is the Refld in your form. For instance, updating a form field will yield immediate results in the table, thus saving the form is not necessary. You can try the various choices and select the one most suitable for your own particular setup. In the form's AfterDelConfirm event, these records are copied into the true audit table only if the Status argument provided by Access indicates that the deletion proceeded.
. Since I have many forms that interact with each of my tables, it seems that record level auditing would simplify my work. The error states that you have provided the wrong number of arguments. But no one has posted a fixes outside of using other forms of auditing. Please guide how can i make it work. The section below only deals with one control on one of my subforms.
I hope I'm making sense here and apologise for being nuisance here. I think maybe I'm right that Audit trial may have been the best option but I'm not sure anymore. This time Access highlights the entire line of code in the Form Delete event that calls the AuditDelEnd function. ActiveForm does not work for sub forms. Or is my logic here all wrong? You have to use the CreateRecord action and set each of the individual fields.
The way the data is saved is determined by how flexible the procedure needs to be and how the Audit Trail data is going to be used once it has been collected. For example if your control is used for entering an employees name, type: Employee Name in the tag property. This may involve storing the details of the deleted record but, if I have incremental backups of my data, I will already have this information to hand. Many thanks, James Back to your original question. Move Your Career Forward with certification training in the latest technologies.
However, there is no control on the form with that name. Check your references from the Tools menu and be sure to have these selected: Save and close the module. In the code I show you what I changed so hopefully this will help in your studies. I can also avoid code errors by trying to read a value from the wrong sort of control such as a Label. So, now we are ready to get started. What code would return the value of my records autonumber field? Your form, the table in grid view, a crafty user in Excel - it don't matter, the changes will be logged.
I have been able to open your database and see the method you are using. Access cannot log changes to your data at the record level. I currently only have one AfterUpdate Macro set up at the time. I have forms where records have been deleted. The block of code starting For and ending with Next comprises a code loop which visits each control on the currently active form this means I don't have to specify a form by name.
Fortunately, a user can edit only a single record in any one form at one time. Don't ignore it; take advantage of it. If your database is split into two mdb files, the table created at step 2 must be in the code mdb workstation file , and the table at step 5 in the data mdb server file. Build the Audit Trail Table The first task is to build the table that will receive the records of changes to the database. Add Code to the Form's BeforeUpdate Event Select the form itself by either clicking the small box where the rulers meet in the upper left corner of the form design window, or by choosing Form from the drop-down list at the top of the Property Sheet.
Now, becuase the subform is the one initiating the command, it will be passed along to basAudit sub instead of the ActiveForm wich is the main form, not the subform. The With frm stayed where it was and I put my code right after the first Next ctl. A comprehensive Audit Trail records not only what changes are made but when and by whom. It's more than this solution. Hope that helps you in your understanding of the issues here. Don't ignore it; take advantage of it.