G
Guest
I created a subroutine to call in other subroutines on the same form. (I even tried calling it a function and still had a problem.) I call the subroutine three times in the form. The first two have no problems, but the third states "Run Time Error 28, Out of Stack Space." When I looked it up in Help, it suggested I may have the procedure too nested. I don't understand why it would work in two of of three of the calls and not the third when they appear functionally identical. The code is below. The error comes on the Form_Current command. Please advise. THANKS!
Private Sub PaymentType()
Dim blnCheck As Boolean
Dim blnCharge As Boolean
On Error Resume Next
blnCheck = Me.cbxCheck
blnCharge = Me.cbxCharge
If blnCheck = True Then
Me.txtCheck_.Visible = True
Me.lblCheck_.Visible = True
Else
Me.txtCheck_.Visible = False
Me.lblCheck_.Visible = False
End If
If blnCharge = True Then
Me.cboCardType.Visible = True
Me.lblCardType.Visible = True
Me.txtCard_.Visible = True
Me.lblCard_.Visible = True
Me.txtExpiration.Visible = True
Me.lblExpiration.Visible = True
Else
Me.cboCardType.Visible = False
Me.lblCardType.Visible = False
Me.txtCard_.Visible = False
Me.lblCard_.Visible = False
Me.txtExpiration.Visible = False
Me.lblExpiration.Visible = False
End If
End Sub
Private Sub cbxCharge_Click()
PaymentType
End Sub
Private Sub cbxCheck_Click()
PaymentType
End Sub
Private Sub Form_Current()
PaymentType
End Sub
Private Sub PaymentType()
Dim blnCheck As Boolean
Dim blnCharge As Boolean
On Error Resume Next
blnCheck = Me.cbxCheck
blnCharge = Me.cbxCharge
If blnCheck = True Then
Me.txtCheck_.Visible = True
Me.lblCheck_.Visible = True
Else
Me.txtCheck_.Visible = False
Me.lblCheck_.Visible = False
End If
If blnCharge = True Then
Me.cboCardType.Visible = True
Me.lblCardType.Visible = True
Me.txtCard_.Visible = True
Me.lblCard_.Visible = True
Me.txtExpiration.Visible = True
Me.lblExpiration.Visible = True
Else
Me.cboCardType.Visible = False
Me.lblCardType.Visible = False
Me.txtCard_.Visible = False
Me.lblCard_.Visible = False
Me.txtExpiration.Visible = False
Me.lblExpiration.Visible = False
End If
End Sub
Private Sub cbxCharge_Click()
PaymentType
End Sub
Private Sub cbxCheck_Click()
PaymentType
End Sub
Private Sub Form_Current()
PaymentType
End Sub