Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mysterious variable not found error in Access 2007

Status
Not open for further replies.

hedgracer

Programmer
Mar 21, 2001
186
US
I have the following code:

Public Function BSS_Payment_chkExchange()
intCount = intCount + 1
strExch = "Exchange" 'OK
strSelect = strSelect & ", Exchange"
If chkGroupBy = -1 Or chkSumQuantity = -1 Or _
chkSumCashAdjusted = -1 Or chkSumUnadjustedGiveUpRevenue = -1
Or _
chkSumDetailDisputed = -1 Or chkSumTotalAmtDue = -1 Then
strGroupBy = strGroupBy & ",Exchange"
End If


If Not IsNull(cboExchange) Then
intTextB = 0
strWhere = strWhere & "AND (" & _
strExch & _
" = '" & _
cboExchange & _
"') "
End If

End Function

I am getting a "Variable Not Defined" error message on
chkSumTotalAmtDue when I compile but not on the the other items
starting with chk. These are not variables but check boxes. All are
set up exactly the same in the VBA code. Can someone give me a clue to
what I am possibly missing? Thanks for all help in advance.


Dave





 
I try to be more explicit with references to form controls.
Code:
Public Function BSS_Payment_chkExchange() 
'where are intCount, strExch, strSelect, strGroupBy,
' intTextb, strWhere defined?

  intCount = intCount + 1 
  strExch = "Exchange"   'OK 
  strSelect = strSelect & ", Exchange" 
  If Me.chkGroupBy = -1 Or Me.chkSumQuantity = -1 Or _ 
      Me.chkSumCashAdjusted = -1 Or _
      Me.chkSumUnadjustedGiveUpRevenue = -1 Or _
      Me.chkSumDetailDisputed = -1 Or _
      Me.chkSumTotalAmtDue = -1 Then 
        strGroupBy = strGroupBy & ",Exchange" 
  End If 

  If Not IsNull(Me.cboExchange) Then 
    intTextB = 0 
    strWhere = strWhere & "AND (" & _ 
                  strExch & _ 
                  " = '" & _ 
                  Me.cboExchange & _ 
                  "') " 
  End If 
End Function

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top