I have two problems in the attached sample.
1. If I leave the recordsource statement un-commented, the code goes straight to the "Createdby_Gotfocus" event, runs it then returns to the onload event.
Comment it out and the code runs as expected.
2. With the "on error resume next" statements commented out the code crashes as it tries to set focus to a previously focused control.
Remove the comments and it works.
The first problem only seems to happen with this test code.
I encounter the second problem often when moving to the next control without actually selecting something in a combobox.
I don't like to use the on error construct as it just hides a problem but I am unable to find an alternate that avoids this.
I use a construct like
1. If I leave the recordsource statement un-commented, the code goes straight to the "Createdby_Gotfocus" event, runs it then returns to the onload event.
Comment it out and the code runs as expected.
2. With the "on error resume next" statements commented out the code crashes as it tries to set focus to a previously focused control.
Remove the comments and it works.
The first problem only seems to happen with this test code.
I encounter the second problem often when moving to the next control without actually selecting something in a combobox.
I don't like to use the on error construct as it just hides a problem but I am unable to find an alternate that avoids this.
I use a construct like
Code:
me.cboX = me.cboX.itemdata(0)
if nz(me.cboX.itemdata(1),"") ="" then
me.cboNext.setfocus
else
me.cboX.dropdown
end if