hello. i have a tabcontrol called TABCTLMAIN. it has 3 tabs at the moment. tab(0) labeled FIND CLAIM; tab(1) labeled MANUALLY FINALIZE CLAIM, and tab(2) labeled PROCESS LOG. form opens and starts at first field on tab(0), which is fine. i display data and have user input on this tab. i have a boolean function called MANUAL UPDATE ALLOWED. when user clicks on second tab i call the function. depending on contents of some fields, if the result of function is true, then i want to let user go to tab(1) and set focus to field CBOCLMSTATUS (a combo box). if the result of function is false, i want to prevent user from leaving ... i.e., stay on tab(0), but set focus to field REQUESTOVERRIDE (a text field). i am trying to use the ONCLICK event of tab(1).
so, if user tries to go to 2nd tab, the boolean function checks various conditions, and figures out if claim can be finalized. if true, go to 2nd tab for additional data input, otherwise stay on main tab, and request help.
Code:
Private Sub Manually_Finalize_Claim_Click()
If ManualUpdateAllowed Then
Me.TabCtlMain.Value = 1
Me.cboClmStatus.SetFocus
Else
Me.TabCtlMain.Value = 0
Me.txtRequestOverride.SetFocus
End If
End Sub
i stripped down the boolean function while trying to debug. basically, the code below is checking to make sure a desired field is not "blank". will eventually add additional tests, but this is as simple as i can get at the moment. when the form opens, the REFF8 field doesn't have any data in it. when i try to go to 2nd tab, it goes there fine, which is not what want/expect.
Code:
Private Function ManualUpdateAllowed() As Boolean
If IsEmpty(Me.txtFindREFF8) Or IsNull(Me.txtFindREFF8) Then
MsgBox "REF-F8 does not contain data"
ManualUpdateAllowed = False
Else
MsgBox "REF-F8 is oK"
ManualUpdateAllowed = True
End If
End Function