Arrays (I think)

B

BRC

I have a macro that initalizes a variable a gets a value for the var that is
a code. The code is associated with a building name. I am trying to
convert the code to the name inside the macro. For instance the code is
"asbldg", in a table this refers to the "Anwar Sadat building." how can I
translate the code into the building within the macro? the table that
contains the info has 2 fields buildingcode and Buildingname. The table has
about 110 records. should i try to put the table into an array and then look
for the code in the array? As you may have guessed I am kind of lost here
and perhaps abit over my head. any suggestions would be appreciated.
BRC
 
A

Andy Newland

Hi,

The correct way to do this is to interogate the database
with your code and return the full office name. I would
suggest you learn how this is done.

However, if you are not very proficient and are just
looking for a quick fix then you could build a (very)
large select case statement.

i.e.

dim strOfficeName as String

Select Case strOfficeCode
Case "asbldg"
strOfficeName = "Anwar Sadat building."
end select

Obviously if you add more offices then you will have to
add them to your select statement.

Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top