Question : dumb Access VBA question

Hi,

how can you use a string to refer to a form control in Access?  for example;

Ive passed the string values "strFormName" and "strControlName" and I now want to use them to refer to a control on a open form

Forms![strFormName].[strControlName]

I'm sure it's really simple the answer escapes me!

Answer : dumb Access VBA question

Field length is not determined by IIF, but the first record of the result, if the first record results in "SoftPak" the SystemType field would be C(7), if the first record is a "Tower" the SystemType is C(5). That's the way foxpro determines field types of an expression/ a computed field.

So cast to the field type and legth you want:
CAST( IIF(...) As C(7)) As SystemType ...

or PAD:
PADR(IIF(...,"SoftPak","Tower"),7) AS SystemType ...

or simply add the needed two spaces to "Tower":
IIF(...,"SoftPak","Tower  ") AS SystemType

Bye, Olaf.
Random Solutions  
 
programming4us programming4us