Report Expression

S

swansonray

I have a field that contains the following information:
Example is of the two situations, there is more records than these 2...

D-183U
C-126

I am using an expression in my report

Expr2: Right([Bed#],3)

If the far right character is a "U" I want the end result to have 4
characters in the report so "183U" would be in the report, not "83U" and if
there isn't a "U" on the far right the end result to be "126"

Thank you,

Ray Swanson
 
D

Duane Hookom

If the hyphen is always present then you might try:
BedPart: Mid([Bed#],Instr([Bed#],"-")+1)

BTW: Don't leave the "Expr2". It's reall bad practice to not change this.
 
S

swansonray

Thank you Duane for your assitance so far. You guys are great!,

The hyphen is part of an input mask. When I used the code you provided the
end result in the query and the report came out like this:

D183U
C126

In the report the desired effect is to not have the leading alpha character.

I was not aware that the use of Expr's is bad practice. I will change my
ways... ;-)

Ray Swanson
Lemoore, CA

Duane Hookom said:
If the hyphen is always present then you might try:
BedPart: Mid([Bed#],Instr([Bed#],"-")+1)

BTW: Don't leave the "Expr2". It's reall bad practice to not change this.

--
Duane Hookom
Microsoft Access MVP


swansonray said:
I have a field that contains the following information:
Example is of the two situations, there is more records than these 2...

D-183U
C-126

I am using an expression in my report

Expr2: Right([Bed#],3)

If the far right character is a "U" I want the end result to have 4
characters in the report so "183U" would be in the report, not "83U" and if
there isn't a "U" on the far right the end result to be "126"

Thank you,

Ray Swanson
 
D

Duane Hookom

My take on significant controls and columns with names like "text21",
"Command7", "Expr11", etc is that a programmer is basically too lazy to
properly rename these to something that makes sense. If a question comes here
with a default name like this, it suggests the control or column is
significant.

This should work unless there is something else significant you haven't told
us:
BedPart: Mid([Bed#],2)

--
Duane Hookom
Microsoft Access MVP


swansonray said:
Thank you Duane for your assitance so far. You guys are great!,

The hyphen is part of an input mask. When I used the code you provided the
end result in the query and the report came out like this:

D183U
C126

In the report the desired effect is to not have the leading alpha character.

I was not aware that the use of Expr's is bad practice. I will change my
ways... ;-)

Ray Swanson
Lemoore, CA

Duane Hookom said:
If the hyphen is always present then you might try:
BedPart: Mid([Bed#],Instr([Bed#],"-")+1)

BTW: Don't leave the "Expr2". It's reall bad practice to not change this.

--
Duane Hookom
Microsoft Access MVP


swansonray said:
I have a field that contains the following information:
Example is of the two situations, there is more records than these 2...

D-183U
C-126

I am using an expression in my report

Expr2: Right([Bed#],3)

If the far right character is a "U" I want the end result to have 4
characters in the report so "183U" would be in the report, not "83U" and if
there isn't a "U" on the far right the end result to be "126"

Thank you,

Ray Swanson
 
S

swansonray

This did work, THANK YOU, I appreciate the help...

Ray Swanson
Lemoore, CA

Duane Hookom said:
My take on significant controls and columns with names like "text21",
"Command7", "Expr11", etc is that a programmer is basically too lazy to
properly rename these to something that makes sense. If a question comes here
with a default name like this, it suggests the control or column is
significant.

This should work unless there is something else significant you haven't told
us:
BedPart: Mid([Bed#],2)

--
Duane Hookom
Microsoft Access MVP


swansonray said:
Thank you Duane for your assitance so far. You guys are great!,

The hyphen is part of an input mask. When I used the code you provided the
end result in the query and the report came out like this:

D183U
C126

In the report the desired effect is to not have the leading alpha character.

I was not aware that the use of Expr's is bad practice. I will change my
ways... ;-)

Ray Swanson
Lemoore, CA

Duane Hookom said:
If the hyphen is always present then you might try:
BedPart: Mid([Bed#],Instr([Bed#],"-")+1)

BTW: Don't leave the "Expr2". It's reall bad practice to not change this.

--
Duane Hookom
Microsoft Access MVP


:

I have a field that contains the following information:
Example is of the two situations, there is more records than these 2...

D-183U
C-126

I am using an expression in my report

Expr2: Right([Bed#],3)

If the far right character is a "U" I want the end result to have 4
characters in the report so "183U" would be in the report, not "83U" and if
there isn't a "U" on the far right the end result to be "126"

Thank you,

Ray Swanson
 

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