RTE 94 - form loading sequence?

caferacer

Registered User.
Local time
Today, 23:44
Joined
Oct 11, 2012
Messages
96
Hi All,

I have a RTE 94 happening due to a piece of code running on a subform current-event which looks at a text box on the parent form. I understand this is due to the order of loading of the forms initially and all works fine when moving to other records once all are opened. How can I overcome this happening on first opening?

I am thinking I need to set a counter on the subform on load event to say 1, then when the subform current-event fires add some code so if the counter is 1, then do nothing, if 0 then run the code. When the mainform opens reset the counter to 0, then requery the subform. The form will now see the counter is set to 0 for the rest of the time, so will then always run the code.

Not sure how to go about setting out the code as I guess there needs to be some form of Public variable involved?

Thanks.
 
Last edited:
Invalid use of Null.
 
Check out the IsNull() function and the Nz() function, which provide tools to interrogate a variable, determine if it is null, and take appropriate action before the error occurs. Sample code . . .

Code:
Sub RunSomeCode
   If Not IsNull(Me.tbSomeText) then
[COLOR="Green"]      'this code only executes if me.tbSomeText is not null[/COLOR]
   End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom