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

access report newline in textbox

Status
Not open for further replies.

Bastien

Programmer
May 29, 2000
1,683
CA
inside a text box

currently using chr(13):

=IIf(IsNull([addr1]),"",[addr1]) & IIf(IsNull([addr2]),"",Chr(13) & [addr2]) & IIf(IsNull([addr3]),"",Chr(13) & [addr3]) & IIf(IsNull([addr4]),"",Chr(13) & [addr4]) & IIf(IsNull([city]),"",Chr(13) & [city]) & IIf(IsNull([Province]),"",", " & [Province]) & IIf(IsNull([Postal]),"",Chr(13) & [Postal])

Should I be using VBNewline or Chr(10)?

This is for an access 97 DB

TIA
Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
Hi,

First a tip, try using nz(feild,[valueIfNull]) instead of testing for nulls with iif - will be quicker and easier to read.

I use the vbCrLf constant in code, but I think you need both CR and LF if you are using ascii (ie Chr(13) & Chr(10))

Cheers

Steve
 
it doesn't seem to understand the vbCrLf code. Do i need to reference something?

This is on a report, if that makes a difference Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
You should have a code Reference set up for "Visual Basic For Applications" that points to (default location):
Code:
C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6.DLL
This code library contains a "Constants" member where vbCrLf is defined.
 
C:\Program Files\Common Files\Microsoft Shared\VBA\VBA332.dll

is where I'm pointing... Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
Hi,

The vbCrLf will only work in code, not as a constant in the source for a text box. That means that you can use it if you use some VBA code in the background to set the value of a control on your form.

If you are simply trying to make multiple lines in a text box, you were on the right track with ascii, but use [firstField] & Chr(13) & Chr(10) & [nextField] to make

FirstFieldValue
SecondFieldValue

Sorry if I confused you.

Cheers

Steve
 
thanks

that got it Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top