Re: Expression



I have a string that I want to break up into three fields. The string has
three possible formats as follows:

B21 00000000104U
F10100000000249U
F2GY00000000126U

If the string begins with a "B" then I want to break it down to first field
data, "B21" in field [Building] and disregard the 8 zeros and keep the data
"104U" in field [Bunk].

If the string begins with an "F" and third character is an integer then I
want to break it down to first field data "F1" in field [Facility] and second
field data "01" in field [Building] and disregard the 8 zeros and third field
data "249U" in field [Bunk].

If the string begins with an "F" and the third character is "G" then break
it down to first field data "F2" in field [Facility] and second field data
"GY2" in field [Building] and disregard the 8 zeros and third field data
"126U" in field [Bunk]. Note that the 2 in F2 must be added to the GY to
differentiate the location. Each GY is one of four. Example GY1, GY2, GY3. or
GY4

Please also note that each string is different and only the format is
consistent. All of the three fields combined are unique and will be
CONCATENATED to be
B21-104U
B01-249U
GY2-126U

What do you think?

Thanks,
Dennis



"Van T. Dinh" wrote:

> Describe in words what you are trying to do, i.e. the logic of your
> calculation.
>
> Your expression is incoorect: the IIf is used with exactly 3 aruments and
> you have 4. If you meant the Left() function, its 2 arguments must be in
> parentheses.
>
> HTH
> Van T. Dinh
> MVP (Access)
>
>
>
> "Don" <Don@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:6CDE9F99-998A-4B10-B432-0A17C63C9A47@xxxxxxxxxxxxxxxx
> > I am trying to make an IIf statement and am getting errors. The following
> is
> > the expression:
> >
> > Building:=IIf(Left [Housing],1="B" ,Left[Housing],3)
> >
> > What might be the problem?
> >
> > Thanks,
> >
> > Dennis
> >
>
>
>
.



Relevant Pages