I posted this on the Microsoft Access "Other" messageboard and it didn't generate much of a response to something that is really confusing me! Anybody here able to give me some help? 
Using Access 2000 I have the following code on a button click event:
sSQLString = "SELECT * FROM MainArea"
DoCmd.Hourglass (Yes)
Form_ViewObsoleteColumns.List1.RowSource = sSQLString
DoCmd.Hourglass (No)
This successfully populates my listbox with the expect 100+ results.
I then used (still within the same button click event):
sTemp = Form_ViewObsoleteColumns.List1.Column(1)
msgbox(sTemp)
90% of the time this returns "NULL". The other 10% of the time it returns the expected value of "Milton".
My gut feel is that I've got a race condition happening that means when I do my
sTemp = Form_ViewObsoleteColumns.List1.Column(1)
code the listbox hasn't finished populating or something like that.
I've tried sTemp = Form_ViewObsoleteColumns.List1.SetFocus and this has made no difference.
Any ideas or pointers would be appreciated (as always!)
Using Access 2000 I have the following code on a button click event:
sSQLString = "SELECT * FROM MainArea"
DoCmd.Hourglass (Yes)
Form_ViewObsoleteColumns.List1.RowSource = sSQLString
DoCmd.Hourglass (No)
This successfully populates my listbox with the expect 100+ results.
I then used (still within the same button click event):
sTemp = Form_ViewObsoleteColumns.List1.Column(1)
msgbox(sTemp)
90% of the time this returns "NULL". The other 10% of the time it returns the expected value of "Milton".
My gut feel is that I've got a race condition happening that means when I do my
sTemp = Form_ViewObsoleteColumns.List1.Column(1)
code the listbox hasn't finished populating or something like that.
I've tried sTemp = Form_ViewObsoleteColumns.List1.SetFocus and this has made no difference.
Any ideas or pointers would be appreciated (as always!)