CHR() Function not available

El Rebelde

Registered User.
Local time
Today, 15:25
Joined
Nov 10, 2006
Messages
12
I have a database in which I am designing a report which includes a name/address block. I am surprised to find that the report does not recognise the Chr() function in the text box control source string "=[Organisation] & Chr(13) & Chr(10) & [Address]..."; designed to insert a CRLF between the contents of the named fields.

I know the syntax is correct because I've checked by using the expression builder to replicate the code. (Expression builder includes the Chr() function, as expected.)

The interesting thing is that the function is recognised in other databases used on the same machine, both those created remotely and locally.

Anyone know what could be going wrong?

Stuart
 
that should work. you can replace chr(13) and (chr(10) with vbcrlf which is a vb constant for cr lf

so = [organisation] & vbcrlf & [address]
----------------------
i've had trouble with text boxes before on reports - try using a label with the same syntax
 
gemma-the-husky said:
that should work. you can replace chr(13) and (chr(10) with vbcrlf which is a vb constant for cr lf

so = [organisation] & vbcrlf & [address]
----------------------
i've had trouble with text boxes before on reports - try using a label with the same syntax

Thanks Gemma, but the problem exists throughout the database; the function is not recognised in queries either. I'm sure there are ways round the problem, but it worries me more because other functions may compromised in a similar way.

vbcrlf is not recognised by the problem database or those that are working correctly. They interpret it as a user input field [vbcrlf] and ask for data to assign to an eponymous variable.

(Nice avatar BTW!)
 
My mother always criticised me for never knowing when to stop.

Here's a script to insert a conditional tab, as wel as a conditional CRLF.

=IIf([Orgtel]>"0","Switchboard" & Chr(9) & [orgtel],"")&iif([Orgfax]>"0", chr(13)&chr(10)&"Fax"&chr(9)&[Orgfax],"")​

This would create a really impressive telephone list, except that Access doesn't recognise Chr(9).

Any suggestions?

Stuart
 

Users who are viewing this thread

Back
Top Bottom