Asked by:
Form_Load is not triggerd for PopUp in DatasheetView

Question
-
I think I've found a bug. In the event Form_Load I often set the caption of the form. When that failed once, it appeared that, under the following settings, Form_Load was not even triggered:
- DefaultView = 2 (datasheet)
- PopUp = True
- AllowAdditions = False
When DefaultView = 2, PopUp = False, AllowAdditions = False, Load is not triggered.
When DefaultView <> 2, PopUp = True, AllowAdditions = False, Load is not triggered.
When DefaultView = 2, PopUp = True, AllowAdditions = True, Load is triggered.
If AllowAdditions = False, there is no current record. This determines whether Form_Load is activated.
It's strange that only under these settings Load is not triggered. Therefore I think it's a bug. Or do I miss something?
- Edited by Peter van Loosbroek Sunday, September 10, 2017 9:38 PM
Sunday, September 10, 2017 9:33 PM
All replies
-
Hi,
AllowAdditions = False does not necessarily means a "no current record" unless you're opening an unbound form or filtering the form to an empty recordset. Regardless if Load event fires or not, do you see a record when the form opens? If not, can you share the RecordSource? Thanks.
Sunday, September 10, 2017 9:37 PM -
Hi DBGuy,
I've tested in different situations. Set the RecordSource in the event Open with an SQL instruction. Set the WHERE component such that no records are the result. So, when AllowAddition = False, there is no current record (and no new record because AllowAddition = False.<sub></sub><sup></sup><strike></strike>
Sunday, September 10, 2017 9:46 PM -
In my initial explanation I should write:
If AllowAdditions = False, AND there is no current record.
Sunday, September 10, 2017 9:52 PM -
In my initial explanation I should write:
If AllowAdditions = False, AND there is no current record.
In this case, the issue you described may be "by design" rather than a bug. The Load event fires after "loading" the form's recordset. So, if the form is empty and cannot move the pointer to a new record, there is nothing to load and probably the Load event is prevented from firing.
This is just my guess, since I cannot presume to know exactly what is going on inside Access, but this is what sense to me based on what you said.
Just my 2 cents...
Sunday, September 10, 2017 9:58 PM -
Yes, your reasoning is right. I agree. There is nothing to load when there are no records. But... this is only a problem in datasheet view or PopUp. In addition, you should be able to use the Load event also for other purposes.Sunday, September 10, 2017 10:18 PM
-
When there is no RecordSource set, Load normaly is trigered.Sunday, September 10, 2017 10:21 PM
-
Hi,
Thanks for the additional information. Like I said, I couldn't say for sure if it's by design or a bug.
Good luck!
Sunday, September 10, 2017 10:30 PM -
I try to test with the settings you had mentioned above with Access 2016 version.
(1) DefaultView = 2, PopUp = False, AllowAdditions = False
Note : in Access 2016 you can not insert number as Default View. you have to select option. so I select Datasheet as you had mentioned above.
also you need to choose "True" or "False" for Allow Additions and Pop Up.
the result when I run the form, the load event get executed.
(2) DefaultView <> 2, PopUp = True, AllowAdditions = False.
this time also Load event get executed.
(3) DefaultView = 2, PopUp = True, AllowAdditions = True
with settings above Load event get executed successfully.
so with Access 2016, I am not able to reproduce the issue single time , every time load event executes correctly.
here, I want to confirm with you that with which version of Access you are making these tests?
let us know about that, we will try to make a test with that to check the result.
I also suggest you to update your Access with latest available updates. so if this issue was solved in update then you can get to know about it.
I also want to confirm with you that to check whether you can reproduce this issue with any database or just with any specific database.
if other database are working fine then it is possible that your current database get corrupted. in that situation you can try to use compact and repair option.
I also want to suggest you to put a break point on load event and try to run the form with your above mentioned settings and check whether load event get executed or not.
you can also post your code of load event. so that we can check what you are doing actually.
Regards
Deepak
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
- Edited by Deepak Saradkumar PanchalMicrosoft contingent staff Monday, September 11, 2017 2:20 AM
Monday, September 11, 2017 2:14 AM -
I am convinced there is a bug. Today I'll be back to explaine and show you how to reproduce the failure.Monday, September 11, 2017 8:42 AM
-
you had mentioned,"I am convinced there is a bug."
first I want to inform you that you did not provided the complete information.
as I asked , with which version of Access you are making test?
as per our testing with Access 2016, we are not able to reproduce the issue.
but we don't know which version you are using.
also you did not try any other approach that I mentioned in my response.
so currently, we cannot confirm that this is bug without reproducing the issue on our side.
I suggest you to provide as much as information regarding your issue.
so that we will again try to make a test on our side and try to find the cause and try to decide whether it is a bug or not.
also let us know about exact version of Access will help us to understand the issue in better way.
Thanks for your understanding.
Regards
Deepak
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.Monday, September 11, 2017 8:53 AM -
Here is another explanation how to reproduce the failure I mentioned in my initial report.
Tested in: Access version: 2016 (Dutch). Versions are automatically updated. I've tested in another database to (even created a new one) and created a new form. The same failure occurs.
The following description is exactly according my method. Create a form and set the following properties:
- Property sheet: DefaultView: Datasheet. Or in Visual Basic in event Open: Me.DefaultView = 2. Doesn't matter, it’s the same.
- Property sheet: PopUp: True
- Property sheet: AllowAdditions: False
- Event Open: Set the SQL instruction for RecordSource. Set the WHERE component such, that the result is an empty recordset. In this example I've set the WHERE component on a value which I am sure this will result in no records. Me.RecordSource = "SELECT
Orders.* FROM Orders WHERE Orders.OrderID=-100;"
To test whether the event Load is executed:
Private Sub Form_Load()
Me.Caption = "Hello"
MsgBox "Event Load is executed"
End SubWhat now is crucial? Because AllowAdditions is set to False, there is no current record and also no new record. (Current record can be also a new record.) In this case the event Load is not executed. Of course is doesn't matter whether the WHERE component is set or a case there are just no records. But to use the WHERE component, it's more easy to test.
Additional information:
If DefaultView is set to another value then datasheet, the event Load is executed.
If PopUp is set to False, the event Load is executed.
If AllowAdditions is set to True, the event Load is executed (because there is a new record (even the recordset has no records).
When there are no records, you should think it's not necessary that the event Load is executed (because there is nothing to load). But in many other situations event Load is just executed. Many times I use the event Load, even in dialogs (where Modal is set to True). For example to set the forms Caption (see https://msdn.microsoft.com/VBA/Access-VBA/articles/form-load-event-access).
I know datasheets are sometimes very powerful, but sometimes they have limitations. I think the problem has to be sought in the DAO area.
Monday, September 11, 2017 11:24 AM -
currently I have Access English installed.
I try to change the language to Dutch, by chnaging the language from Options.
but it did not affect anything.
I suggest you to change the language to English and try to make a test again to verify.
also I want to confirm with you that are you using Access MSO or Access Click to run version?
sometimes one version work correctly but other have issue in it.
it is better if you post the picture of your version.
we will try to verify that.
Regards
Deepak
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.Tuesday, September 12, 2017 2:18 AM -
Hi Deepak,
Here is screenshot of my version. "Klik-en-Klaar" means "Click-and-Run"
I changed the language and the results are the same. I think the language has no effect on this case. To test in another language, the Access version itself should be language based.
By the way, did you test in your English version and what was the result?
- Edited by Peter van Loosbroek Tuesday, September 12, 2017 8:00 AM
Tuesday, September 12, 2017 7:59 AM -
Hi Deepak,
Another tip: I tested also by set the properties in Visual Basic. Not only by the property sheet. So I think you can eliminate the language.
Tuesday, September 12, 2017 8:05 AM -
I am not able to reproduce the issue with English version.
so it is possible that issue is with in Dutch version of Access.
I am not available with Dutch version of Access so I am not able to make a test with it.
last thing you can try to update the Access.
I can see that my version is 1708 and your version is 1707.
check whether it makes any difference or not.
if that also not solve the issue then I suggest you to provide your feedback to Access User Voice regarding this issue.
Welcome to Access Suggestion Box!
Regards
Deepak
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.Tuesday, September 12, 2017 8:45 AM -
Dear Deepak,
Thanks for your effort until so far. Today or tomorrow I'll report it to the Access Suggestion Box, as soon as I can. But first I'll try to update my version (thought it starts automatically).
- Edited by Peter van Loosbroek Tuesday, September 12, 2017 8:55 AM
Tuesday, September 12, 2017 8:53 AM -
Hi Peter,
Could you make a test with your access database under English version of Access to check whether it is related with Access version?
If it could be reproduced under English version, could you share us a simple Access database which could reproduce your issue through OneDrive? We will try to make a test with your file.
Best Regards,
Edward
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.Monday, September 25, 2017 6:07 AM -
Hi Edward,
I cannot test in the English version.
This problem is reported on the Suggestion Box. Are you aware of this?
https://access.uservoice.com/forums/319956-access-desktop-application/suggestions/31389313-form-load-is-not-executed-for-popup-in-datasheetvi
- Edited by Peter van Loosbroek Monday, September 25, 2017 9:00 AM
Monday, September 25, 2017 8:58 AM -
Hi Peter,
I could see your post on uservoice.com, and I would suggest you keep waiting response from uservoice.com.
Best Regards,
Edward
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.Tuesday, September 26, 2017 6:27 AM