NName Group

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello
I have Report and Field called: NName.
On the Report I created: NName Header
In "NName Header" Show only First chracter and it follow on detail same
first chracter as phone list.

Well, my question is: How can Let "NName Header" show cracter A, but in the
list show few chracter that first left chracter as 1, 2, 3, A and Ã

Because I don't have many post that start with 1, 2, 3 and à so that why I
want they be with A group



Here is exmple:


A and if there is kod looks 1-Ã
-----
11111
2uuuu
3kkkk
Aaaaa
Àuuu
_____________

And then be as usual like this:
B
-----
BBBB
Bjkjs
Bdjkjd



Thanks
 
One (clunky) approach, add an additional field to the query your report is
based on:

FirstLetter: IIf(Asc(UCase(Left([NName],1)))>64 And
Asc(UCase(Left([NName],1)))<91,UCase(Left([NName],1)),"A")

Explanation: Asc will return 65 thru 90 for upper case letters A thru Z. If
the 1st letter of NName is within that range, the first letter is returned,
otherwise the letter A is returned (numbers, punctuation, etc.)

Group on FirstLetter and use it as your Header field in the report.

Alternative Formula:
FirstLetter: IIf(ABS(77.5 - Asc(UCase(Left(NName,1))))>12.5,
UCase(Left([NName],1)),"A")

HTH,
 
Thank you for the code you wrote.

I made little change and I like it to be as this code in Quesry:


FirstLetter:
IIF(Abs(5-Asc(UCase(Left([NName],1))))>51,UCase(Left([NName],1)),"0 - Ã") OR
IIF(Abs(Asc(UCase(Left([NName],1))))="Ã",UCase(Left([NName],1)),"0 - Ã")


But the problem is that this code it give result on Query: -1 instead the
result be as: 0 - Ã

I mean when th first cracter on the post is: 1, 2, 3 or à Then result is
on query be: 0 - Ã
And other chracter such as B, C, D etc will show as normal.

Can you please fix this code above, because I think the problem is the 0 - Ã
be repited wto times in the same code.


Jesus Bless
 
Well, you now have 2 complete IIF statements connected with an OR. If
either IIF statement <> 0 (which they will) then the OR evaluates the whole
thing as TRUE. TRUE is usually represented by -1.

Here's an adjustment to my first suggestion that does what you want, I
think:

FirstLetter: IIf(Asc(UCase(Left([NName],1)))>65 And
Asc(UCase(Left([NName],1)))<91,UCase(Left([NName],1)),"0-A")

HTH,
 
Back
Top