wrong number of arguments

F

fgwiii

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
 
T

Tom Ellison

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
 
C

Carl Rapson

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

Just based on what you've posted, it looks like you have one too many
closing parentheses at the end.

Carl Rapson
 
F

fgwiii

Here is the problem;

The original query I was running was this:

PAGE: Mid([RDCIS]![DCI_NAME],7,9) & IIf([RDCIS]![DCI_NAME]="Page_03a",".0" &
[RDCIS]![SUBEVENT],IIf([RDCIS]![DCI_NAME]="Page_04",".0" &
[RDCIS]![SUBEVENT],IIf([RDCIS]![DCI_NAME]="Page_07",".0" &
[RDCIS]![SUBEVENT],"")))

This code was fine with the exception that if the field [RDCIS]![SUBEVENT]
contained a anything greater then a single digit, the result was as follows:
4.010
4.012
4.011
4.08
4.09
But what I need is:
4.10
4.12
4.11
4.08
4.09
There is probably an easier way to accomplish this, I just don't know how.

Thank you,

Fred

Tom Ellison said:
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
 
T

Tom Ellison

Dear FG:

Your example does not contain sufficient example to see where the problem
is. It also omits the complete values in DCI_NAME, from which 9 characters
are being extracted into your result. This is too much confusion for me to
handle.

Please give an accurate and complete sample of the incoming columns and of
the desired result.

Tom Ellison
Microsoft Access MVP


fgwiii said:
Here is the problem;

The original query I was running was this:

PAGE: Mid([RDCIS]![DCI_NAME],7,9) & IIf([RDCIS]![DCI_NAME]="Page_03a",".0"
&
[RDCIS]![SUBEVENT],IIf([RDCIS]![DCI_NAME]="Page_04",".0" &
[RDCIS]![SUBEVENT],IIf([RDCIS]![DCI_NAME]="Page_07",".0" &
[RDCIS]![SUBEVENT],"")))

This code was fine with the exception that if the field [RDCIS]![SUBEVENT]
contained a anything greater then a single digit, the result was as
follows:
4.010
4.012
4.011
4.08
4.09
But what I need is:
4.10
4.12
4.11
4.08
4.09
There is probably an easier way to accomplish this, I just don't know how.

Thank you,

Fred

Tom Ellison said:
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
 

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