1. ## array (Access 2000)

I have a report with a control called CustomerID containing the customer numbers.
I have the following function
Dim cutsomer as control
set customer = Reports![Invoice]![customerid]
if customer = 960 or 730 or 560 or etc then
Reports![Invoice]![lblCsutomer].visible = true
These special customers all 7 in number

I want to convert the above code into array something like that

dim customer(1 to 7) as string
Dim i as integer
For i =1 to 7 then
Reports![Invoice]![lblCsutomer].visible = true
next
end sub

But i receive no action perhaps i double the commands.May i have some help?

2. ## Re: array (Access 2000)

If I understand your question correctly, you can write code like this:

Dim Cust(1 To 7) As Integer
Dim i As Integer
Dim f As Boolean
Cust(1) = 560
Cust(2) = 730
' ...
Cust(7) = 970
For i = 1 To 7
If CustomerID = Cust(i) Then
f = True
Exit For
End If
Next
Reports!rptInvoice!lblCustomer.Visible = f

Another solution is to put the special values of CustomerID in a table, say tblSpecialCustomers.
The code can be reduced to:

Reports!rptInvoice!lblCustomer.Visible = _ &
Not IsNull(DLookup("CustomerID", "tblSpecialCustomers", "CustomerID=" & CustomerID))

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•