Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie query: Cant get CHR$(13) to work ? ? ?

Status
Not open for further replies.

GloverK

Technical User
May 15, 2002
6
0
0
GB
I am trying to loop through some VBA code in an Access database, build a string as it goes along based on events in the loop then show the string in a text box control. Problem is that the Chr$(10) and CHR$(13) are being displayed as squares in the txt box.

example of code :

str="Error Log"
....process
str=str & chr($10) & chr$(13) & "Check index number : " & indx & chr($10) & chr$(13)
....loop
str = str & chr($10) & chr$(13) & "finished processing"
text0.setfocus
text0.text=str

Can anyone help ? Why is it doing this.

PS it is happening in Access 97 and 2000.

[machinegun] [flame]
 
you used: chr($10) & chr$(13)

try: chr(10) & chr(13)

or just use: vbCrLf

PaulF
 
Is this a typo
str=str & chr($10)
$ is in wrong place
str=str & chr$(10)

 
Yes, the ($10) thing was a typo. Soz....

PaulF, ive tried the first suggestion but Ill have a go with the second one and let you know. Thanks for the suggestions..
 
PaulF - you are a star....works a treat. Thanks for the help.

Dont mean to be cheeky but do you knw how to print out the contents of the text box by clicking a button now ? ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top