ccIces
Jan 19 2012, 01:25 PM
Do you put the recordsource code on the form's load event or open event?
I understand the order of events but not clear on the load events purpose. From what I have read, it fires after the data loads. If this is correct, then my recordsource code should go on open event no?
theDBguy
Jan 19 2012, 01:35 PM
Hi,
Why not just directly use the Record Source property? If you're trying to dynamically change the record source, then yes, I think the Open event is appropriate.
Just my 2 cents...
ccIces
Jan 20 2012, 08:43 AM
for this instnace, the rs will change on a preset time so it is a function that recalculates the recordset based on the time.
But, when the form/subform first loads, I currently have the recordsource unbound. So although it onlyhappens in testing, the form comes up with #name in the controls as they are bound to the names of what the record set contains. So, I wanted to add the call to the sub routine as the form opens to populate set the recordsource but I did not know if it would be better on open or load.
After playing with it for a few, Isee that it should go on open - if it is on load, then it first appears with #name in the controls then flashes to the correct recordsource. Which now that I think about it, makes the event order make sense!
Thanks!
theDBguy
Jan 20 2012, 09:07 PM
Hi,
Couldn't you just set the RecordSource property in Design View to avoid the #Name error? You should still be able to change it in code when you need to recalculate the data.
Just my 2 cents...