Solved Listbox AfterUpdate and click when there is no selection (2 Viewers)

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:54
Joined
Feb 19, 2002
Messages
43,275
We can't see the videos you are posting.

I built the form and I tested it to see what events would fire. The Before and After update events do not fire during scrolling.
 
Local time
Today, 09:54
Joined
Sep 16, 2023
Messages
35
I had to put it public
I thought that with the link you could see it even if it was private
but apparently I have to send the Google account of each user who wants to see it and not just the link
 
Last edited:

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:54
Joined
Feb 19, 2002
Messages
43,275
The video doesn't show anything except that you clicked on the control. If you click on the control, it fires the Before/AfterUpdate events. If you want to scroll but NOT select, you have to click on the down arrow.

PS, the video is too fast and too fuzzy to be useful for anything.
 
Last edited:
Local time
Today, 09:54
Joined
Sep 16, 2023
Messages
35
The video doesn't show anything except that you clicked on the control. If you click on the control, it fires the Before/AfterUpdate events. If you want to scroll but NOT select, you have to click on the down arrow.
No, first I click and then use the arrows only 4 times and the 3 events continue to appear
You can see a dotted line on each item indicating the new position if you click and without selecting
Is it the application you sent me?
Can you try it yourself?
 

June7

AWF VIP
Local time
Today, 05:54
Joined
Mar 9, 2014
Messages
5,472
I changed my listbox to Simple multiselect and tested AfterUpdate event. It is triggered when cursor moves through items, even if I don't click into listbox - I click on scroll bar then use cursor keys - no item is highlighted, just dotted line around current item line. The AfterUpdate event already has code to build filter criteria and since no items are actually selected, there are no values for the filter.

I get same behavior Luis describes.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:54
Joined
Feb 19, 2002
Messages
43,275
When I click on the down arrow without clicking into the control, NO event (for which I have logging) fires. If I click into the control, the Before/After updates run and then the click event runs. If I then click the down arrow, NO logged events run. I don't know what you are doing.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:54
Joined
Feb 19, 2002
Messages
43,275
I'm in the middle of something right now. I'll look at it after noon when the bridge game ends;)
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:54
Joined
Feb 19, 2002
Messages
43,275
@June7 if you have a minute, you might want to download the logging database to see what result you get.
 
Local time
Today, 09:54
Joined
Sep 16, 2023
Messages
35
I understand you but I have to focus on the control, I could do it with tab but a client will not do that, also this should work even when clicking and then arrow and then clicking and then arrow, making only 2 selections not 4, but The events are activated 3 (Before/after/click), 4 times
I'm trying to do what you tell me, I'm using Google Translate, I don't know if that's why, lol
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:54
Joined
Feb 19, 2002
Messages
43,275
Google Translate can get pretty amusing during technical discussions;) The point I keep trying to make is DO NOT use the Before and After update events. Use the click event to determine what was selected. AND you will find this much easier if you try to do what @Edgar_ suggested. It is simpler logically to save the items as they are clicked into a table or dictionary as the sample code Edgar posted uses.
 

June7

AWF VIP
Local time
Today, 05:54
Joined
Mar 9, 2014
Messages
5,472
I am doing what I described above. Click on listbox scrollbar to make it active control then press up/down cursor keys to move through list.

If by "down arrow", you mean listbox scrollbar, then that is what I click on.

I have now viewed Pat's db. As I cursor through listbox (did not click into, just on scrollbar), I see the other form has new records whereas in my db, code to filter does not happen. I set breakpoint in listbox AfterUpdate event and it is triggered with each cursor movement.

So now the mystery for me is why my code does not affect form recordset and Pat's does with cursor movement.
 
Last edited:

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:54
Joined
Feb 19, 2002
Messages
43,275
Clicking on the scroll bar or the down arrow do not fire any of the three events we are talking about. If you are using my sample form and those events are firing, I would be very interested to see that.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:54
Joined
Feb 19, 2002
Messages
43,275
I will add code to the form after my bridge game to see if other events are firing.
 

June7

AWF VIP
Local time
Today, 05:54
Joined
Mar 9, 2014
Messages
5,472
I did not say clicking on scrollbar fires events, cursor key movement does.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:54
Joined
Feb 19, 2002
Messages
43,275
I feel like I am in a tight loop here. I think we are talking about three specific events but you are now talking about other events.
 
Local time
Today, 09:54
Joined
Sep 16, 2023
Messages
35
Interesting.
The elevator or lateral control bar only scrolls and does not execute any events.
The down arrow always does the 3 events (Before/after/click) in this order
The click always makes the 3 events (Before/after/click) in this order
Try it yourself, when you finish your bridge game, lol, no rush and thank you very much, really
 
Last edited:

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:54
Joined
Feb 19, 2002
Messages
43,275
OK, game is over. I added more logging:
1694967033704.png


1694966986693.png


I started by clearing the log so we don't see the form events.

A. Clicking on the scrollbar fires
1. Enter
2. GotFocus

B. Clicking on the down or up arrow does not fire any other events.

C. Clicking on CT fires

3.MouseDown
4.MouseUp
5.BeforeUpdate
6.AfterUpdate
7.Click

D. Clicking on the name control fires
8. Exit
9. LostFocus
 
Local time
Today, 09:54
Joined
Sep 16, 2023
Messages
35
Ok I think I remember that this is an access setting that we are fighting over, or a different version, this using 2016 32 bits for now
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:54
Joined
Feb 19, 2002
Messages
43,275
I love playing with this app (pats self on back:love:). I originally set out to do a video on the form's BeforeUpdate event and why it was the best option for most validation and decided I needed a way to show the events as they happened and came up with this solution.
 

Users who are viewing this thread

Top Bottom