Error 28 Out of Stack Space

louisa

Registered User.
Local time
Today, 08:58
Joined
Jan 27, 2010
Messages
262
Hi Everyone,

My db has worked fine for well over a year and a half, today i am getting this error "Error 28 Out of Stack Space" if i hit debug it takes me to part of my code, i did not code the db and no nothing about it, are you able to help please? Highlighted in pink is the code error, Here is the code:

Public Function UpdateCommission()
If Me.CommissionPayable1 = False Then
Me.CommissionDue = ([GrossOperatingProfit]) / 36 * 5
Else
Me.CommissionDue = 0
End If
Me.CommissionDue.Requery
End Function

Public Function UpdateCommission1()
If Me.CommissionPayable3 = False Then
Me.CommissionDue1 = ([GrossOperatingProfit]) / 2
Else
Me.CommissionDue1 = 0
End If
Me.CommissionDue1.Requery
End Function
Public Function UpdateCommission2()
If Me.CommissionPayable5 = False Then
Me.TelesalesCommission = 40
Else
Me.TelesalesCommission = 0
End If
Me.TelesalesCommission.Requery
End Function
 
i would be surprised if it is that line causing the error

stack space tends to run out due to uncontrolled recursion

you probably ought to look at how the function "updatecommission" is being called
 
Hi, thanks for your advise, the form is set to update on open. I dont really understand the problem as its never happened before.
 
I had this exact problem with one of my userforms. Mine had to do with a change event with a combo box and a few textboxes. The way I had my code structured for all the different change events caused it.

Here is what I have now for my code on my change events. I had to break things down individually to not get the error anymore. I don't know if this will help but maybe it will lead you in the right direction or ring a bell to someone else.

Private Sub chkFollowUp_Change()
If Me.ChkFollowUp = True And Me.txtPrevInvoiceNumber.Value = "" Then
MsgBox "Was this call already a follow up and is continued to be a follow up? If so, make sure the previous invoice number is entered or already there. ", Title:="Follow Up", Buttons:=vbOKOnly + vbQuestion
Me.txtPrevInvoiceNumber.SetFocus
End If
End Sub
Private Sub txtACReceiverLevel_Change()
txtACReceiverLevel.Text = Format("0" & txtACReceiverLevel.Text, "0.0%")
End Sub
Private Sub txtRack1ReceiverLevel_Change()
txtRack1ReceiverLevel.Text = Format("0" & txtRack1ReceiverLevel.Text, "0.0%")
End Sub
Private Sub txtRack2ReceiverLevel_Change()
txtRack2ReceiverLevel.Text = Format("0" & txtRack2ReceiverLevel.Text, "0.0%")
End Sub
Private Sub txtRack3ReceiverLevel_Change()
txtRack3ReceiverLevel.Text = Format("0" & txtRack3ReceiverLevel.Text, "0.0%")
End Sub
Private Sub txtRack4ReceiverLevel_Change()
txtRack4ReceiverLevel.Text = Format("0" & txtRack4ReceiverLevel.Text, "0.0%")
End Sub
Private Sub txtRack5ReceiverLevel_Change()
txtRack5ReceiverLevel.Text = Format("0" & txtRack5ReceiverLevel.Text, "0.0%")
End Sub
Private Sub txtRack6ReceiverLevel_Change()
txtRack6ReceiverLevel.Text = Format("0" & txtRack6ReceiverLevel.Text, "0.0%")
End Sub
Private Sub txtAmountSalesTax_Change()
On Error Resume Next
Me.txtAmountSalesTax.Text = Format(CCur("0" & Me.txtAmountSalesTax.Text), "$#,##0.00")
End Sub
Private Sub txtBaseCharge1_Change()
On Error Resume Next
Me.txtBaseCharge1.Text = Format(CCur("0" & Me.txtBaseCharge1.Text), "$#,##0.00")
End Sub
Private Sub txtBaseCharge2_Change()
On Error Resume Next
Me.txtBaseCharge2.Text = Format(CCur("0" & Me.txtBaseCharge2.Text), "$#,##0.00")
End Sub
Private Sub txtMaterial_Change()
On Error Resume Next
Me.txtMaterial.Text = Format(CCur("0" & Me.txtMaterial.Text), "$#,##0.00")
End Sub
Private Sub txtMaterialTotal_Change()
On Error Resume Next
Me.txtMaterialTotal.Text = Format(CCur("0" & Me.txtMaterialTotal.Text), "$#,##0.00")
End Sub
Private Sub txtSalesTax_Change()
On Error Resume Next
Me.txtSalesTax.Text = Format(CCur("0" & Me.txtSalesTax.Text), "$#,##0.00")
End Sub
Private Sub txtSubCost_Change()
On Error Resume Next
Me.txtSubCost.Text = Format(CCur("0" & Me.txtSubCost.Text), "$#,##0.00")
End Sub
Private Sub txtTotalCost_Change()
On Error Resume Next
Me.txtTotalCost.Text = Format(CCur("0" & Me.txtTotalCost.Text), "$#,##0.00")
End Sub
Private Sub txtTotalDue_Change()
On Error Resume Next
Me.txtTotalDue.Text = Format(CCur("0" & Me.txtTotalDue.Text), "$#,##0.00")
End Sub
Private Sub cboServiceMan1_Change()
On Error Resume Next
Me.TxtSTRate1 = Sheets("Reference Page").Range("B" & Me.cboServiceMan1.ListIndex + 1)
On Error Resume Next
Me.TxtOTRate1 = Sheets("Reference Page").Range("B" & Me.cboServiceMan1.ListIndex + 1) * 1.5
If Me.TxtSTHours1.Value = "" Then
On Error Resume Next
Me.TxtSubTotalLabor1.Value = Me.TxtOTHours1 * Me.TxtOTRate1
Else
On Error Resume Next
Me.TxtSubTotalLabor1.Value = (Me.TxtSTHours1 * Me.TxtSTRate1) + (Me.TxtOTHours1 * Me.TxtOTRate1)
End If
If Me.TxtOTHours1.Value = "" Then
On Error Resume Next
Me.TxtSubTotalLabor1.Value = Me.TxtSTHours1 * Me.TxtSTRate1
Else
On Error Resume Next
Me.TxtSubTotalLabor1.Value = (Me.TxtSTHours1 * Me.TxtSTRate1) + (Me.TxtOTHours1 * Me.TxtOTRate1)
End If
End Sub
Private Sub TxtSTRate1_Change()
On Error Resume Next
Me.TxtSTRate1.Text = Format(CCur("0" & Me.TxtSTRate1.Text), "$#,##0.00")
End Sub
Private Sub TxtSTHours1_Change()
If Me.TxtOTHours1.Value = "" Then
On Error Resume Next
Me.TxtSubTotalLabor1.Value = Me.TxtSTHours1 * Me.TxtSTRate1
Else
On Error Resume Next
Me.TxtSubTotalLabor1.Value = (Me.TxtSTHours1 * Me.TxtSTRate1) + (Me.TxtOTHours1 * Me.TxtOTRate1)
End If
End Sub
Private Sub TxtOTRate1_Change()
On Error Resume Next
Me.TxtOTRate1.Text = Format(CCur("0" & Me.TxtOTRate1.Text), "$#,##0.00")
End Sub
Private Sub TxtOTHours1_Change()
If Me.TxtSTHours1.Value = "" Then
On Error Resume Next
Me.TxtSubTotalLabor1.Value = Me.TxtOTHours1 * Me.TxtOTRate1
Else
On Error Resume Next
Me.TxtSubTotalLabor1.Value = (Me.TxtSTHours1 * Me.TxtSTRate1) + (Me.TxtOTHours1 * Me.TxtOTRate1)
End If
End Sub
Private Sub TxtSubTotalLabor1_Change()
On Error Resume Next
Me.TxtSubTotalLabor1.Text = Format(CCur("0" & Me.TxtSubTotalLabor1.Text), "$#,##0.00")
End Sub
Private Sub txtTotalLabor1_Change()
On Error Resume Next
Me.txtTotalLabor1.Text = Format(CCur("0" & Me.txtTotalLabor1.Text), "$#,##0.00")
End Sub
Private Sub cboServiceMan2_Change()
On Error Resume Next
Me.TxtSTRate2 = Sheets("Reference Page").Range("B" & Me.cboServiceMan2.ListIndex + 1)
On Error Resume Next
Me.TxtOTRate2 = Sheets("Reference Page").Range("B" & Me.cboServiceMan2.ListIndex + 1) * 1.5
If Me.TxtSTHours2.Value = "" Then
On Error Resume Next
Me.TxtSubTotalLabor2.Value = Me.TxtOTHours2 * Me.TxtOTRate2
Else
On Error Resume Next
Me.TxtSubTotalLabor2.Value = (Me.TxtSTHours2 * Me.TxtSTRate2) + (Me.TxtOTHours2 * Me.TxtOTRate2)
End If
If Me.TxtOTHours2.Value = "" Then
On Error Resume Next
Me.TxtSubTotalLabor2.Value = Me.TxtSTHours2 * Me.TxtSTRate2
Else
On Error Resume Next
Me.TxtSubTotalLabor2.Value = (Me.TxtSTHours2 * Me.TxtSTRate2) + (Me.TxtOTHours2 * Me.TxtOTRate2)
End If
End Sub
Private Sub TxtSTRate2_Change()
On Error Resume Next
Me.TxtSTRate2.Text = Format(CCur("0" & Me.TxtSTRate2.Text), "$#,##0.00")
End Sub
Private Sub TxtSTHours2_Change()
If Me.TxtOTHours2.Value = "" Then
On Error Resume Next
Me.TxtSubTotalLabor2.Value = Me.TxtSTHours2 * Me.TxtSTRate2
Else
On Error Resume Next
Me.TxtSubTotalLabor2.Value = (Me.TxtSTHours2 * Me.TxtSTRate2) + (Me.TxtOTHours2 * Me.TxtOTRate2)
End If
End Sub
Private Sub TxtOTRate2_Change()
On Error Resume Next
Me.TxtOTRate2.Text = Format(CCur("0" & Me.TxtOTRate2.Text), "$#,##0.00")
End Sub
Private Sub TxtOTHours2_Change()
If Me.TxtSTHours2.Value = "" Then
On Error Resume Next
Me.TxtSubTotalLabor2.Value = Me.TxtOTHours2 * Me.TxtOTRate2
Else
On Error Resume Next
Me.TxtSubTotalLabor2.Value = (Me.TxtSTHours2 * Me.TxtSTRate2) + (Me.TxtOTHours2 * Me.TxtOTRate2)
End If
End Sub
Private Sub TxtSubTotalLabor2_Change()
On Error Resume Next
Me.TxtSubTotalLabor2.Text = Format(CCur("0" & Me.TxtSubTotalLabor2.Text), "$#,##0.00")
End Sub
Private Sub txtTotalLabor2_Change()
On Error Resume Next
Me.txtTotalLabor2.Text = Format(CCur("0" & Me.txtTotalLabor2.Text), "$#,##0.00")
End Sub
Private Sub cboServiceMan3_Change()
On Error Resume Next
Me.txtSTRate3 = Sheets("Reference Page").Range("B" & Me.cboServiceMan3.ListIndex + 1)
On Error Resume Next
Me.txtOTRate3 = Sheets("Reference Page").Range("B" & Me.cboServiceMan3.ListIndex + 1) * 1.5
If Me.txtSTHours3.Value = "" Then
On Error Resume Next
Me.txtSubTotalLabor3.Value = Me.txtOTHours3 * Me.txtOTRate3
Else
On Error Resume Next
Me.txtSubTotalLabor3.Value = (Me.txtSTHours3 * Me.txtSTRate3) + (Me.txtOTHours3 * Me.txtOTRate3)
End If
If Me.txtOTHours3.Value = "" Then
On Error Resume Next
Me.txtSubTotalLabor3.Value = Me.txtSTHours3 * Me.txtSTRate3
Else
On Error Resume Next
Me.txtSubTotalLabor3.Value = (Me.txtSTHours3 * Me.txtSTRate3) + (Me.txtOTHours3 * Me.txtOTRate3)
End If
End Sub
Private Sub TxtSTRate3_Change()
On Error Resume Next
Me.txtSTRate3.Text = Format(CCur("0" & Me.txtSTRate3.Text), "$#,##0.00")
End Sub
Private Sub TxtSTHours3_Change()
If Me.txtOTHours3.Value = "" Then
On Error Resume Next
Me.txtSubTotalLabor3.Value = Me.txtSTHours3 * Me.txtSTRate3
Else
On Error Resume Next
Me.txtSubTotalLabor3.Value = (Me.txtSTHours3 * Me.txtSTRate3) + (Me.txtOTHours3 * Me.txtOTRate3)
End If
End Sub
Private Sub TxtOTRate3_Change()
On Error Resume Next
Me.txtOTRate3.Text = Format(CCur("0" & Me.txtOTRate3.Text), "$#,##0.00")
End Sub
Private Sub TxtOTHours3_Change()
If Me.txtSTHours3.Value = "" Then
On Error Resume Next
Me.txtSubTotalLabor3.Value = Me.txtOTHours3 * Me.txtOTRate3
Else
On Error Resume Next
Me.txtSubTotalLabor3.Value = (Me.txtSTHours3 * Me.txtSTRate3) + (Me.txtOTHours3 * Me.txtOTRate3)
End If
End Sub
Private Sub TxtSubTotalLabor3_Change()
On Error Resume Next
Me.txtSubTotalLabor3.Text = Format(CCur("0" & Me.txtSubTotalLabor3.Text), "$#,##0.00")
End Sub
Private Sub txtTotalLabor3_Change()
On Error Resume Next
Me.txtTotalLabor3.Text = Format(CCur("0" & Me.txtTotalLabor3.Text), "$#,##0.00")
End Sub
Private Sub TxtWorkFinished1_Change()
On Error Resume Next
Me.TxtWorkFinished1.Text = Format("0" & Me.TxtWorkFinished1.Text, "hh:mm")
End Sub
Private Sub TxtWorkFinished2_Change()
On Error Resume Next
Me.TxtWorkFinished2.Text = Format("0" & Me.TxtWorkFinished2.Text, "hh:mm")
End Sub
Private Sub txtWorkFinished3_Change()
On Error Resume Next
Me.txtWorkFinished3.Text = Format("0" & Me.txtWorkFinished3.Text, "hh:mm")
End Sub
Private Sub TxtWorkStarted1_Change()
On Error Resume Next
Me.TxtWorkStarted1.Text = Format("0" & Me.TxtWorkStarted1.Text, "hh:mm")
End Sub
Private Sub TxtWorkStarted2_Change()
On Error Resume Next
Me.TxtWorkStarted2.Text = Format("0" & Me.TxtWorkStarted2.Text, "hh:mm")
End Sub
Private Sub txtWorkStarted3_Change()
On Error Resume Next
Me.txtWorkStarted3.Text = Format("0" & Me.txtWorkStarted3.Text, "hh:mm")
End Sub
 
I forgot to mention that my form worked fine with all those change events when filling out the form it was when I used that same form to recall a record where all the feilds were filled in at once that I ran into the problem. I'm assuming that is what your form does based on what you are saying. Sorry if this doesn't help. I wish I had the code for the way I originally did it so you could compare the two but I don't.

Anyway... Good luck!
 

Users who are viewing this thread

Back
Top Bottom