Apologies for the misunderstanding. If setting the focus using . SetFocus does not switch to the desired tab in your specific scenario, you can try using the . Value property of the navigation control to programmatically switch the selected tab. Here's an updated version of the code:
Private Sub Form\_Load()
' Check if x1 is equal to 0
If x1 = 0 Then
' Disable NavigationButton1
Me.NavigationButton1.Enabled = False
Else
' Set the Value property of the navigation control to the desired tab
Me.NavigationControlName.Value = "NavigationButton1"
End If
' Check if x2 is equal to 0
If x2 = 0 Then
' Disable NavigationButton2
Me.NavigationButton2.Enabled = False
End If
End Sub
In the code above, replace NavigationControlName with the actual name of your navigation control. Then, set the . Value property of the navigation control to the desired tab's name (e.g., "NavigationButton1") to switch to that tab.
Please note that the exact names of the navigation buttons may differ based on your specific form design. Adjust the code accordingly by replacing NavigationButton1 with the appropriate name of your desired tab button.
If you have any other questions or need assistance with anything, please don't hesitate to let me know. It will be my pleasure to Assist you.
Best Regards,
Sneha
Give back to the community. Help the next person with this problem by indicating whether this answer solved your problem. Click Yes or No at the bottom.