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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

chr(13) and chr(10) not working on all machines

Status
Not open for further replies.

AccessUser22

Technical User
Jan 23, 2003
168
US
I've been using chr(13) & chr(10) & in order to insert a carriage return on a lot of reports. Problem is, when I bring my application to the client to test it out, the fields on the reports that contain this show up as "#Error".

Why does this work on some machines and not others? Am I missing a reference file or library on the "#Error" machines? I've checked my references for the VBA coding and they are always the same in both db's.
 
AccessUser22
Sounds like something funny going on. Maybe a difference in operating systems on the different machines.

Does using vbCrLf, instead of Chr(13) & Chr(10), work?

Or Chr$(13) & Chr$(10)

Just a shot in the dark.

What is the purpose for the carriage returns and line feeds?


Tom
 
The purpose the line returns is that it just makes formatting easier. Also we have several reports that we generate that are actually form letters. It's important for formatting purposes not to insert extra spacing into the body of the letter, so we use it within the body coding. The letter also cannot be broken out and have each paragraph posted in seperatly cause in some cases, the comments fields are null and we don't want to have extra spacing in the letter.

Currently my machine is operating windows 2000 pro, and I've noticed this problem on two client machines. One was using windows 2000 pro, and the other was running windows XP. I run the database using Access 2002, and the machines having the problem use Access 2000 and 2002 respectivly. It doesn't seem to support the operating system theory. I do believe that the vbcrlf it won't recognize if it's coded into the text box control source. I do know that that should work through the vba code, but I don't need to do that on my machine for it to work.

I've never tried to Chr$(13) & Chr$(10) way of writing it. I'll give that a shot next time I'm at the clients site. I just really wish I knew if it was a particular library or file to look for and make sure they have installed on their machine. Thanks for your input.
 
AccessUser22
I see now what you are doing. And given the operating systems you are using I'm not sure that using Chr$ will make any difference. However, Access 2000 uses DAO and I think Access 2002 uses ADO. You might want to be sure that all machines have the References checked for both "Microsoft ActiveX Data Objects 2.1 Library" and "Microsoft DAO 3.6 Object Library". Worth a try.

As for the body of your letter, some thoughts...

1. Separate the paragraphs into separate text boxes, and set the CanGrow and CanShrink properties accordingly to make them come out right.

2. Put IIf logic on your comments field. Such as this text box example...
="We have really appreciated your assistance with our work. " & IIf(IsNull([Comments]),"",[Comments]) & " A receipt will be forwarded at the end of the year."

Tom
 
Thanks for the ideas. I'll give those some thought. It just frustrates me when a piece of code that should work, doesn't. But if I can't get it figured out, you're suggestions will work nicely. Thanks.
 
Often it is the libraries, they may or may not show up in Tools/References as "Missing". You might have DAO 3.6 on one machine and 3.51 on another, for example. I would remove the dao reference, close the dialog, reopen, and re-add it. It's worked for me in similar circumstances.
--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top