Dear FG:
I count 1 more right paren in your post than you have left parens. Perhaps
you need to rework this part of the statement.
Here's your code, formatted a bit differently:
PAGE1: Mid([RDCIS]![DCI_NAME], 7, 9) &
IIf([RDCIS]![DCI_NAME] = "Page_03a", ".0" & [RDCIS]![SUBEVENT],
IIf([RDCIS]![DCI_NAME] = "Page_04" And ([RDCIS]![SUBEVENT] < 10), ".0" &
[RDCIS]![SUBEVENT],
IIf([RDCIS]![DCI_NAME]="Page_04" And ([RDCIS]![SUBEVENT>9), "." &
[RDCIS]![SUBEVENT],
IIf([RDCIS]![DCI_NAME]="Page_07",".0" & [RDCIS]![SUBEVENT],"")))))
May I suggest you "factor out" the [RDCIS]![SUBEVENT] and deal only with
what you want to prepend.
PAGE1:
Mid(RDCIS!DCI_NAME, 7, 9) & "."
IIf(RDCIS!DCI_NAME = "Page_03a", "0", "") &
IIf(RDCIS!DCI_NAME = "Page_04",
IIf(RDCIS!SUBEVENT < 10, "0", ""), "")
IIf(RDCIS!DCI_NAME = "Page_07", "0", "")
& RDCIS!SUBEVENT
There is some question in my mind as to your intent. I expect you want the
column here to start with the 8-16th characters of DCI_NAME (or do you
intend it to contain all the rest of the string?). Notice also that while
"Page_04" is the first 7 characters, "Page_03a" is 8 characters. Perhaps it
is the case that when DCI_NAME starts with "Page_03a" you want to start one
character later.
Then I have some uncertainty whether you want to append the SUBEVENT only
when DCI_NAME starts with "Page_03a", "Page_04" or "Page_07". Your code
seems to have the intention to append SUBEVENT only in these 3 cases, and
not to append it at all otherwise. I was guessing you want it appended in
all cases, but I'm not so sure.
I do not know what range of values you have in DCI_NAME and exactly what
finished product you wish. May I suggest that you give some sample data and
show what you want as a result. Something like:
SUBEVENT = 789
DCI_NAME Result
Hello Dolly Hello 789
PAGE_03a John Smith PAGE_03.0789
PAGE_04 Mary Thomas PAGE_04.789
PAGE_07 Goofy PAGE_07.0789
SUBEVENT = 7
PAGE_04 Mary Thomas PAGE_04.789
This may be something like what you desire, but I'm not at all confident.
Samples of what you want may explain what you want unless you're up to
writing a very tight specification.
Tom Ellison
Microsoft Access MVP
fgwiii said:
Can someone help me figure out what is wrong with this ?
PAGE1: Mid([RDCIS]![DCI_NAME],7,9) &
IIf([RDCIS]![DCI_NAME]="Page_03a",".0" & [RDCIS]![SUBEVENT],
IIf([RDCIS]![DCI_NAME]="Page_04" And ([RDCIS]![SUBEVENT]<10),".0" &
[RDCIS]![SUBEVENT],
IIf([RDCIS]![DCI_NAME]="Page_04" And ([RDCIS]![SUBEVENT>9),"." &
[RDCIS]![SUBEVENT],
IIf([RDCIS]![DCI_NAME]="Page_07",".0" & [RDCIS]![SUBEVENT],"")))))
I am getting an error that I have a function with the wrong number of
arguments