One more condition is needed

G

Guest

I am currently running the following syntax:

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],"")))

The issue I am finding is that I have values in the field [RDCIS]![SUBEVENT]
for Page_04 that are between 1 and 80. The issue with the syntax above is
that sometimes I get a 3 digits where if should only be 2 digits.

For example if the value in the field [RDCIS]![SUBEVENT] for page_4 is "9",
the query results in "4.09", which is okay. But, if the value in the field
[RDCIS]![SUBEVENT] for page_4 is "10", the result is "010" which is not okay.
This issue only appears to be an issue for Page_04.

If you can follow all of this, I will appreciate you help!

Thanks

Fred
 
S

Smartin

fgwiii said:
I am currently running the following syntax:

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],"")))

The issue I am finding is that I have values in the field [RDCIS]![SUBEVENT]
for Page_04 that are between 1 and 80. The issue with the syntax above is
that sometimes I get a 3 digits where if should only be 2 digits.

For example if the value in the field [RDCIS]![SUBEVENT] for page_4 is "9",
the query results in "4.09", which is okay. But, if the value in the field
[RDCIS]![SUBEVENT] for page_4 is "10", the result is "010" which is not okay.
This issue only appears to be an issue for Page_04.

If you can follow all of this, I will appreciate you help!

Thanks

Fred

So you are forcing ".0" to be prepended to the value, but when the value
is 10 or more you throw off your desired format of two characters.

Play around with something like

"." & Right("0" & <stuff>,2)

or maybe

"." & Format(<stuff>, "00")

to coerce <stuff> to conform to your desired two character length.

HTH
 

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

Similar Threads

wrong number of arguments 4
Syntax Issues 3
Help needed with IIF in my query 14
#Error Help Needed 2
Query Help Needed 3
iif condition 21
If...Elseif...Else 2
Sort syntax for multiplie IIF 2

Top