array problem
I’m trying to use/learn arrays & am using one in a standard code module so that a particular array index can stand in for the name of a string, that is meant to lock out a control on a form.
Below code shows declarations and assignment of the of array index in the standard code module & followed by that is the procedure meant to lock out the controls on the form. This procedure (lockTaxes) is not recognizing my array index as a valid reference to a control, could someone help out please?
Public aryTax(7) As String 'assign an array to hold taxes to be locked...
Public Code As Variant 'holds a code...
Public sysTyp As String 'holds 'OA' or 'BE'....
'determines the tax controls to lock on promoPreAapproval/Cpr tab...
Public Function lockTaxes2()
'determine taxes to lock...
Select Case Code
Case "1499"
'has GST,PST,QST open...
aryTax(0) = "ForecastHST"
aryTax(1) = "ActualHST"
Case "1599"
'has HST open
aryTax(0) = "ForecastGST"
aryTax(1) = "ForecastPST"
aryTax(2) = "ForecastQST"
aryTax(3) = "ActualGST"
aryTax(4) = "ActualPST"
aryTax(5) = "ActualQST"
End Select
'locks tax controls...
Public Sub lockTaxes(Code, sysTyp)
'determines which tax controls to lock...
Call lockTaxes2
'lock taxes returned by lockTaxes2()...
Dim intI As Integer
For intI = 0 To 7
If sysTyp = "OA" Then
Forms!NewDataEntry!aryTax(intI).Locked
Else
Forms!BackEndDataEntry!aryTax(intI).Locked
End If
Next intI
End Sub
I’m trying to use/learn arrays & am using one in a standard code module so that a particular array index can stand in for the name of a string, that is meant to lock out a control on a form.
Below code shows declarations and assignment of the of array index in the standard code module & followed by that is the procedure meant to lock out the controls on the form. This procedure (lockTaxes) is not recognizing my array index as a valid reference to a control, could someone help out please?
Public aryTax(7) As String 'assign an array to hold taxes to be locked...
Public Code As Variant 'holds a code...
Public sysTyp As String 'holds 'OA' or 'BE'....
'determines the tax controls to lock on promoPreAapproval/Cpr tab...
Public Function lockTaxes2()
'determine taxes to lock...
Select Case Code
Case "1499"
'has GST,PST,QST open...
aryTax(0) = "ForecastHST"
aryTax(1) = "ActualHST"
Case "1599"
'has HST open
aryTax(0) = "ForecastGST"
aryTax(1) = "ForecastPST"
aryTax(2) = "ForecastQST"
aryTax(3) = "ActualGST"
aryTax(4) = "ActualPST"
aryTax(5) = "ActualQST"
End Select
'locks tax controls...
Public Sub lockTaxes(Code, sysTyp)
'determines which tax controls to lock...
Call lockTaxes2
'lock taxes returned by lockTaxes2()...
Dim intI As Integer
For intI = 0 To 7
If sysTyp = "OA" Then
Forms!NewDataEntry!aryTax(intI).Locked
Else
Forms!BackEndDataEntry!aryTax(intI).Locked
End If
Next intI
End Sub