Hello,
I have an unbound no-multi-select listbox. When user changes selection in the listbox I need to run a check to verify if some conditions are met. If not, I need to set listbox selection back to previous one and set focus to a textbox that didn’t pass the check. I tried a number of things with no luck. Below is a sample pseudocode that I had in mind, but obviously it doesn’t work. Any suggestions are greatly appreciated!
‘*****pseudocode*****
‘g_MyListIndex – global variable
‘CheckEntry is just a Boolean function to do certain checks
Private Sub lstMyListBox_AfterUpdate()
If not CheckEntry(me.txtMyTextbox) then
Me.lstMyListBox.setfocus
Me.lstMyListBox.ListIndex = g_MyListIndex
Me.txtMyTextbox.setfocus
Else
g_MyListIndex = me.lstMyListBox.ListIndex
End if