-
Hi, is there a way of dynamically indicating what the variable names are in a type. Say I have:
Type Employee
FName as string
MName as string
LName as string
Addr1 as string
(and so on)
End Type
Say these names match fields in a database table. If I later add a new field in the table (Email, for example), I want to add to the Employee type: Email as string
Is there a way to do this without opening the code again and installing updates? I know when you read a recordset, you can dynamically determine the field names.
Thanks in advance.
-
You could create a dynamic array of strings, but that means you can't have those names
Code:
Type Employee
a() as string
End type
-
If I did that, is there a way of dynamically setting the variable type (I'm thinking no), or at least a way of deallocating memory from variables that aren't needed -- say I make 12 string variables but only need 8 initially.
Thanks.
Wade
-
You can redimension your string array
Code:
DIm b as Employee
redim b.a(8)
'Then later you could do:
Redim preserve b.a(12)
'If you want to deallocate:
Erase b.a
-
It's not perfect, but it's progress. Thanks :)