Trouble Getting Value from Subform (1 Viewer)

rekabeilla

New member
Local time
Yesterday, 21:46
Joined
Apr 18, 2020
Messages
17
Hi,

I have a navigation form (that i coded, not the built in navigation form) that i placed an unbound subform on. On click in the menu changes the control source of the subform to display that specific page. I don't want the user to navigate away from the current page without saving so on the on click event for the menu buttons, i want to check to see if the subform is loaded and if it is I want to check to see if a checkbox is true. That's where i hit a wall. The first line runs through so it knows the subform is loaded to that page, BUT I think I have the syntax wrong referring to the control source. This is what I have:

Code:
If Me.NavSubForm.SourceObject = "tbl_Clinic Entry" Then
    If [Forms]![tbl_Clinic Entry].Controls!Check245 = False Then
        If 'do something'
        Else 'do something else'
        End If
    End If
End If

Code breaks on line 2, so how should this be coded?

Thank you!
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 19:46
Joined
Oct 29, 2018
Messages
21,542
Hi. Try:
Code:
If Me.NavSubForm.SourceObject = "tbl_Clinic Entry" Then
    If Me.NavSubForm.Form!Check245 = False Then
...
Hope that helps...
 

rekabeilla

New member
Local time
Yesterday, 21:46
Joined
Apr 18, 2020
Messages
17
Hi. Try:
Code:
If Me.NavSubForm.SourceObject = "tbl_Clinic Entry" Then
    If Me.NavSubForm.Form!Check245 = False Then
...
Hope that helps...

Yes that works thank you so much. I was thinking too far into it.
 

Users who are viewing this thread

Top Bottom