UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> When Do You Set The Recordsource Of A Subform?, Office 2010    
 
   
ccIces
post Jan 19 2012, 01:25 PM
Post #1

UtterAccess Guru
Posts: 562
From: Belle River, Ont, Canada



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?
Go to the top of the page
 
+
theDBguy
post Jan 19 2012, 01:35 PM
Post #2

Access Wiki and Forums Moderator
Posts: 48,599
From: SoCal, USA



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... (IMG:style_emoticons/default/2cents.gif)
Go to the top of the page
 
+
ccIces
post Jan 20 2012, 08:43 AM
Post #3

UtterAccess Guru
Posts: 562
From: Belle River, Ont, Canada



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!
Go to the top of the page
 
+
theDBguy
post Jan 20 2012, 09:07 PM
Post #4

Access Wiki and Forums Moderator
Posts: 48,599
From: SoCal, USA



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... (IMG:style_emoticons/default/2cents.gif)
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th June 2013 - 06:07 AM