Checking which NavigationSubForm is open/loaded conditional programming ? (1 Viewer)

liamfitz

Registered User.
Local time
Today, 13:20
Joined
May 17, 2012
Messages
240
The following code is in the Load event of a form. It doesn't even execute the code, and the form doesn't open.
Code:
If [Forms]![FrmNavigationLeft].[Form]![NavigationSubform].[Form]![NavigationSubform].[Form].[Name] = "frmClosures" Then
    rfnum = [Forms]![FrmNavigationLeft].[Form]![NavigationSubform].[Form]![NavigationSubform].[Form].[Referral_Num]
Else
    rfnum = Forms!FrmNavigationLeft!NavigationSubform.Form!NavigationSubform!sfrmReferrals.Form!Referral_Num
End If

As you will see, I am passing a value from one of two forms ( the same field value ), to the variable 'refnum'. It is important I differentiate between the calling or 'opening' forms, as this value will vary. The syntax for storing the right field value in 'refnum' is correct, as I have checked this, but as soon as I place the 'If' branches into the code, it hangs/does not load the form. Any ideas please ?:(
 

pr2-eugin

Super Moderator
Local time
Today, 13:20
Joined
Nov 30, 2011
Messages
8,494
Did you try stepping through this bit of code? It might help you see if the logical flow is correct..

On the other hand, are you seeing what form is opened/loaded and based on that open another form?
 

liamfitz

Registered User.
Local time
Today, 13:20
Joined
May 17, 2012
Messages
240
Yes, I have tried setting a breakpoint, but as the Form_Load event now doesn't 'happen' AT ALL, it's not much use. I'm going to try loading the Form.Name value into a variable and check this is an available variable, which can then potentially be used for checking purposes. :confused:
 

pr2-eugin

Super Moderator
Local time
Today, 13:20
Joined
Nov 30, 2011
Messages
8,494
Strange that Form Load is not triggered.. So try adding message boxed to pop up and see what happens..

So what is that you are trying to do? Maybe the choice of your method be not right.. As you know Form Open, Form Load are only triggered once in the lifetime of the Form.
 

liamfitz

Registered User.
Local time
Today, 13:20
Joined
May 17, 2012
Messages
240
Problem solved, thanks for your interest pr2-eugin. I used the
Code:
Form.Name
property/value, to test which of the NavigationSubForms is currently loaded/open. From this, dependent on the 'result', I can then determine the source of the field value, which is available, to utilise in my code. Happy days. :)
 

Users who are viewing this thread

Top Bottom