Which form events occur when Form.Requery is called? - ms-access

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.

Related

Record Time taken to complete a google form

I am trying to record the total time taken to complete and submit a Google form.
My logic is simple that the following code would record and put the timestamp as a multiple choice option.
Then upon submitting the form, we get a time stamp anyway but along with that, we would get the initially recorded timestamp as an answer to that question.
This is my cute little code:
function initial() {
var form = FormApp.getActiveForm();
form.getItemById(1589920082).asMultipleChoiceItem().setChoiceValues([new Date()]);
}
I have set the trigger as OnOpen but surprisingly, it does not renew the timestamp every time I open the form. Theoretically, it should record the time when the form was open but I think I am missing something here.
On the other hand, if I change the trigger to OnSubmit, it starts recording fresh timestamps every time I submit the form. But I don't want that as we get submission timestamps anyway. What I am trying to record is the time the form was open.
I know this question was asked a year ago, but here is a workaround I just came up with.
Have 2 forms! The first form can be a disclaimer, instructions, etc. The second form is the original form you intended for the users to fill out. Turn on email collection for both, so you can know which user submitted the test.
Get the sharing link and in the settings of the first form add the link in the confirmation message:
Then link both forms into a spreadsheet and you will see the time stamp of each submissions. From there you can easily do a calculation to determine the duration.
Unfortunately you cannot have any code executed when user opens form for filling in, as onOpen trigger is not supposed to be run in this case:
https://developers.google.com/apps-script/guides/triggers/#onopen
The onOpen() trigger runs automatically when a user opens a spreadsheet, document, or form that he or she has permission to edit. (The trigger does not run when responding to a form, only when opening the form to edit it.)
There is an open feature request in Google Issue Tracker to introduce some kind of onOpen trigger when form opened for response, you can "star" it to make it more possible to appear: https://issuetracker.google.com/issues/63985842

allow scroll through existing records, but prohibit addition of new records

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.

MS Access 2003: Update form table representation on table change

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 ...

MSAccess VBA Run code when the user navigates to a different record

I have a form that has the navigate buttons on the bottom.
I would like to run some code every time the user navigates to a different record.
Under which event handler would I place this code? Form_OnLoad only runs the code when I open the form. I'm a bit lost. Thanks!
You should use the Current Event.

How do I simply set up an alert/reminder for dates set in MS Access?

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.