array not being recognized

arage

Registered User.
Local time
Today, 13:05
Joined
Dec 30, 2000
Messages
537
array not being recognized
I’m calling a function in a standard code module from a forms openEvent, to lock out certain tax fields that are on it, the standard code module has a function that assigns a value to an array.

***Here’s my standard code module:***

Option Compare Database
Option Explicit

'assign an array to hold taxes to be locked...
Public aryTax(3) As String

'lock taxes on promoPreAapproval/Cpr tab...
Public Function lockTaxes(GlobalRegionCode As Variant)

'determine taxes to lock...
Select Case GlobalRegionCode
Case "1099"
'1099" has all taxes open...
Case "1199"
'has all taxes open...
Case "1299"
'has GST & PST open...
aryTax = Array("QST", "HST")
Case "1399"
'has GST & PST open...
aryTax = Array("QST", "HST")
Case "1499"
'has GST,PST,QST open...
aryTax = Array("HST")
Case "1599"
'has HST open
aryTax = Array("GST", "PST", "QST")
End Select

End Function

***Here’s the code from my form’s openEvent****

Private Sub Form_Open(Cancel As Integer)

'lock taxes based upon region...
Call lockTaxes(GlobalRegionCode)

Dim intI As Integer

For intI = 0 To 3
Me.Controls!("Forecast & aryTax(intI)").Locked = True
Next

End sub

Could someone tell me why I get a “Type-Declaration character does not match declared data type” error? I get it on the openEvent within the above FOR loop on this line:
Me.Controls!("Forecast & aryTax(intI)").Locked = True



[This message has been edited by arage (edited 11-07-2001).]
 
I fixed above so far with this:

***Standard code module:***
Option Compare Database
Option Explicit
'assign an array to hold taxes to be locked...
Public aryTax(3) As String

'lock taxes on promoPreAapproval/Cpr tab...
Public Function lockTaxes(GlobalRegionCode As Variant)

'determine taxes to lock...
Select Case GlobalRegionCode
Case "1099"
'1099" has all taxes open...
Case "1199"
'has all taxes open...
Case "1299"
'has GST & PST open...
aryTax(0) = ("QST")
aryTax(1) = ("HST")
Case "1399"
'has GST & PST open...
aryTax(0) = "QST"
aryTax(1) = "HST"
Case "1499"
'has GST,PST,QST open...
aryTax(0) = "HST"
Case "1599"
'has HST open
aryTax(0) = "GST"
aryTax(1) = "PST"
aryTax(2) = "QST"
End Select

End Function

***Forms open event***
Private Sub Form_Open(Cancel As Integer)

'lock taxes based upon region...
Call lockTaxes(GlobalRegionCode)

Dim intI As Integer

For intI = 0 To 3
Me("Forecast" & aryTax(intI)).Locked = True
Next
End sub

I’m having trouble concatenating the statement in the FOR loop just above though. It ought to read ….ForecastPST ….etc
 

Similar threads

Users who are viewing this thread

Back
Top Bottom