when I do changes in a table and then close it and look in the form which shows it, the updates are not visible until I refresh the form. Can I attach - like, a trigger whenever the table is updated, all forms in which it is present are updated to reflect the new state? The only events I found were Enter and Exit, and those are not what I'm looking for since I will most often edit the data in the actual table, not by Entering and Exiting it within a form.
Can I attach - like, a trigger whenever the table is updated, all forms in which it is present are updated to reflect the new state?
Access versions prior to 2010 offer nothing for this. Access 2010 added a feature called data macros which can supposedly act somewhat like triggers in other rdbms products. However I don't know whether data macro capabilities would allow you to refresh selected open forms; I suspect not.
If the issue is the forms never update at all after you modify the table data ... until/unless you manually refresh the form ... double-check the Recordset Type property on the Data tab of the form's property sheet. And if that property is set as Snapshot, change it to Dynaset.
If you can't resolve this any other way, you could build a new form for the table. Do your table edits in that form. And in that form's after insert, update, and delete events add code to requery any of the related forms which are open. But I wouldn't want to do that ...
Related
I have a simple database that is used to store reports generated by officers within my department. I need to find a way to "lock" reports once they're completed and submitted by an officer. Once a report is locked, it can be opened but not modified.
I've tried to use the "Allow Edits" property but that won't work because if an officer is working on a report and closes the window, they can no longer modify it, even if they haven't completed and submitted it.
I thought of a few ways to do this, but I'm not sure exactly how to do any of them.
Have a "Submit Report" button on the form that once clicked, copies the record from the "Reports" table to the "Completed Reports" table. The information in the "Completed Reports" table is read only.
I don't really have a preference on how it works, I just need to have it so once a report is submitted, it cannot be modified
any thoughts on how I could go about doing this?
I have a form in Access which is designed to allow the user to make changes to existing records, but I don't want them to be able to add a record. Is there a setting for this, or do I need code?
you can open the form in design mode and under the Data tab of the form's property sheet set the AllowAdditions property to No.
This Microsoft Article details the order of events that occur when a form is opened, gets focus etc. but doesn't clarify exactly what happens when a form/subform is requeried. The MSDN page for Form.Current confirms this event as occurring on a refresh or requery, but are any other events also triggered?
Taken from here: https://msdn.microsoft.com/en-us/library/office/ff191903.aspx
The Requery method does one of the following:
Reruns the query on which the form or control is based.
Displays any new or changed records or removes deleted records from the table on which the form or control is based.
Updates records displayed based on any changes to the Filter property of the form.
When a user enters data into a form control, the On Update event fires code which enters data to the table via other controls on the form. So for example, entering a BMI of 31 into one field updates the corresponding Obesity field to show that the person is clinically obese.
When I upload data directly into the table, is there a way for me to get this VBA code to run and update all the necessary values, without having to manually go into each record via the form and do something to fire it?
Not in version 2007, Access 2010 includes "data macro's" which can monitor table updates. For 2007 you would need a copy running on a standalone machine somewhere that could check the table in a loop and then fire events if it detects a change.
I have a database in MS Access and within it I am holding dates for expirations for SSL's. I want to set a reminder for any SSL that is soon to expire. Anyone know the easiest way to go about this?
It all depends on how you want the notification to work.
You can pop-up a form when the database opens
or at any time using a timer
or in a form event
You can build events into Outlook
You can run some script in the task manager
You can send an email using any of the above.
The easiest way to pop-up a form may be to create a form that runs when the database opens or when the menu form opens. This can be set in the start-up options. The form should be based on a query that checks for out of date records and is only made visible if there is data. You can check the recordset in the load event to see if anything is returned. This for can also use DoCmd.SendObject to send an email.