snow-raven
Registered User.
- Local time
- Today, 01:25
- Joined
- Apr 12, 2018
- Messages
- 48
I have a question about a specific behavior of the CSTR() function. I was using STR() to convert integer fields to text before concatenating the converted fields, a text field, and some new text with "&". However, this added a space before the text numeral that I couldn't have in my export table.
Code looked like this:
Output looked like this:
1\n 3\n 4\n 5\n90/2
Desired output:
1\n3\n4\n5\n90/2
Following mdlueck's thread "Str() seems to add a space character, why?", I switched my STR functions to CSTR.
However, that created error if one of the integer fields was blank. (For example, "1\n3\n4\n5" and "1\n3\n4\n5\n90/2" were fine, but I got an error on "1\n3\n4" or "1\n3\n4\n90/2"). I do not get the same error for these entries if I use the STR() function, so what is it about the CSTR function that changes the behavior with the & operator?
Note: I do not need assistance with a new function. I went back and used mdlueck's TRIM(STR()) solution. I just want to understand why CSTR was giving me an error if an integer field was blank.
Code looked like this:
Code:
Blow_Counts: IIf(IsNull([Query].[First_Integer] & [Query].[Second_Integer] & [Query].[Third_Integer] & [Query].[Fourth_Integer]),"",(Str([Query].[First_Integer]) & ("\n"+Str([Query].[Second_Integer])) & ("\n"+Str([Query].[Third_Integer])) & ("\n"+Str([Query].[Fourth_Integer])) & ("\n"+[Query].[Text])))
Output looked like this:
1\n 3\n 4\n 5\n90/2
Desired output:
1\n3\n4\n5\n90/2
Following mdlueck's thread "Str() seems to add a space character, why?", I switched my STR functions to CSTR.
However, that created error if one of the integer fields was blank. (For example, "1\n3\n4\n5" and "1\n3\n4\n5\n90/2" were fine, but I got an error on "1\n3\n4" or "1\n3\n4\n90/2"). I do not get the same error for these entries if I use the STR() function, so what is it about the CSTR function that changes the behavior with the & operator?
Note: I do not need assistance with a new function. I went back and used mdlueck's TRIM(STR()) solution. I just want to understand why CSTR was giving me an error if an integer field was blank.