Concatenation - mysterious space appears???

  • Thread starter disneygoof via AccessMonster.com
  • Start date
D

disneygoof via AccessMonster.com

This is a really good one...I have been trying all sorts of different
combinations and I get the same result each time. NOW with this said, I did
solve this problem and I am offering this to everyone for FYI. Feel free to
verify this and let me know WHY???? this is happening, I fixed it but I don't
know why it's happening

below is my code..partial...

inlen = Me.DummyNum.SelLength
numVal = left(DummyNum, inlen - 1)
If IsNumeric(numVal) Then
inval = numVal
Me.Number = inval
Me.Num = str(inval) & Me.SubNum & Me.Type
Me.DummyNum = str(inval) & Me.Type
Else...

Without going into too much detail, you see two TEXTBOX fiels 'Num" and
DummyNum"...don't ask...
The only difference between the two is the "SUBNUM" field (this is letter: a,
b, c, etc)

ISSUE:
The 'DummyNum' field, after concatenation, is somehting like "20E"...without
the quotes.
The 'Num' field, after concatenation, comes out somehting like " 20aE"...
without the quotes..note the leading space infront of the "20".

SOLUTION:
I got rid of the str(inval) and just used 'inval'.
Keep in mind, I do not get his issue with the "DummyNum" field using str
(inval)....

All comments are welcome. I am courious as to WHY this is happening...
 
D

Douglas J. Steele

The Str function puts a space in front of positive numbers. That space
contains a - sign for negative numbers.
 
D

disneygoof via AccessMonster.com

Agreed...but why does it work in the one case ond not the other? Both
conditions yield positive numbers, but on the one condition gives me the
space... I read this, but it did not explain what I am seeing....?
David
The Str function puts a space in front of positive numbers. That space
contains a - sign for negative numbers.
This is a really good one...I have been trying all sorts of different
combinations and I get the same result each time. NOW with this said, I
[quoted text clipped - 35 lines]
All comments are welcome. I am courious as to WHY this is happening...
 
A

Albert D. Kallal

Perhaps dummum is consider a number field?

it be that your 20E is conseridered a scientific notation number...

? isnumeric( "hello" )
False

? isnumeric(123)
True

? isnumeric(20E2)
True

Perhaps the expression is being evaluated as number, or there is some type
of format on the text box (number, and it getting converted to a number..and
hence the space goes away).
 
D

disneygoof via AccessMonster.com

Makes sense, I did not think about scientific notation...thank you.
D.
 
D

disneygoof via AccessMonster.com

Thank you
D.
Change str(inval) To Cstr(inval)
This is a really good one...I have been trying all sorts of different
combinations and I get the same result each time. NOW with this said, I did
[quoted text clipped - 30 lines]
All comments are welcome. I am courious as to WHY this is happening...
 

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