Richie,
Thank you for the response. I did not catch the nuance of the help file about using a module instead of a form. I was able to declare the arrays public after adding a module to my project.
Interestingly, though, now one of my other arrays is not working properly. I am declaring it as follows:
Const DAY180 = 180
Const DAY120 = 120
Const DAY90 = 90
Const DAY60 = 60
Const DAY30 = 30
Const EXPIRE_DAY = 1
'This array contains the names of the Renewal Reminder controls we loop through within the code
arrayRenewalControlNames = Array("DAY180", "DAY120", "DAY90", _
"DAY60", "DAY30", "EXPIRE_DAY")
I am using the array for a couple of purposes. In one instance I use the array elements to build the names of the form controls in a For Next loop, as follows. This code still works after moving the array to the module.
With "txt" & arrayRenewalControlNames(i)
.Value = arrayRenewalDates(i, 1)
.Enabled = vbFalse
.BackColor = vbGrayText
End With
With "cbox" & arrayRenewalControlNames(i)
.Enabled = vbFalse
.Value = arrayRenewalDates(i, 2)
.BackColor = vbGrayText
End With
I am also using the CONSt definitions of the elements to test calculate and dates. This is the code that now does not work since moving the array to the module. BTW I also moved the CONST declarations as well. When I step through the code, arrayRenewalControlNames(i) now evaluates to 0 instead of the CONST value. I've tried casting the value with CInt() and Val(), but I get type mismatch errors when using those functions.
When I was declaring this array inside the procedure, this code worked fine. Any ideas?
If DateDiff(Day_IntervalType, Date, dtRenewalDate) >= arrayRenewalControlNames(i) Then
' There is suffucient time to schedule the appointment, so calculate the date and set the checkbox flag to True
arrayRenewalDates(i, 1) = AdjustWeekendDate(DateAdd(Day_IntervalType, -(arrayRenewalControlNames(i)), dtRenewalDate))