473,287 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Eliminating blank lines in Query and Table records

I have created an address field that consists of Address1; Address2; City, State and Zip. When all are populated this would create a three line record. However, when there is no Address2, I would like it to appear as a two line record. What do I need to insert here? Here is what I have used to date:
Expr: Address1 & Chr(13) & Chr(10) & Address2 & Chr(13) & Chr(10) & City & ', ' & State & ' ' & Zip

In Reports I have used the Trim function, but that does not seem to work in Queries and Tables.

Any suggestions??
May 28 '10 #1

✓ answered by ChipR

You could use something similar to:
Expand|Select|Wrap|Line Numbers
  1. Expr: Address1 & Chr(13) & Chr(10) & 
  2.   IIf(IsNull(Address2),"", Address2 & Chr(13) & Chr(10)) & 
  3.   City & ', ' & State & " " & Zip
If no Address2 means the field is null. If it's an empty string, you would use
Expand|Select|Wrap|Line Numbers
  1.   IIf(Address2="",...

2 1529
ADezii
8,834 Expert 8TB
@Bigdaddrock
Expand|Select|Wrap|Line Numbers
  1. Expr: [Address1] & IIf(IsNull([Address2]),"",Chr(13) & Chr(10) & [Address2]) & Chr(13) & Chr(10) & [City] & ', ' & [State] & ' ' & [Zip]
May 28 '10 #2
ChipR
1,287 Expert 1GB
You could use something similar to:
Expand|Select|Wrap|Line Numbers
  1. Expr: Address1 & Chr(13) & Chr(10) & 
  2.   IIf(IsNull(Address2),"", Address2 & Chr(13) & Chr(10)) & 
  3.   City & ', ' & State & " " & Zip
If no Address2 means the field is null. If it's an empty string, you would use
Expand|Select|Wrap|Line Numbers
  1.   IIf(Address2="",...
May 28 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Ruben | last post by:
Hello. I am trying to read a small text file using the readline statement. I can only read the first 2 records from the file. It stops at the blank lines or at lines with only spaces. I have a...
0
by: Luke Airig | last post by:
I am trying to merge two xml files based on common date/time and then write out a tab-delimited xml file with the header record from one of the input files concatenated in front of the merged...
5
by: MX1 | last post by:
Hi, I have a report with Name1 and Name2 in the address section . Sometimes, Name2 is not populated with data via the query that feeds the report. Unfortunately, the blank line stays in the...
1
by: Melissa | last post by:
I created a report that is grouped and I set it to go to a new page after each section. Each page will have a different number of records. I have a function that looks at the number of records and...
6
by: Melissa | last post by:
Does anyone have a generic procedure for adding blank lines to reports like Sales details, PO details and/or Orders details. The procedure would need to count the number of line items, determine...
1
by: DAnne | last post by:
Hi, I have checked your archives but have not been able to find anything that works for my situation. I have a for loop that brings back a list of unique responses for each section in a report....
6
by: EricR | last post by:
I am trying to bcp import a text file into a SQL Server 2000 database. The text file is coming out of a java application where order information is written to the text file. Each record is on it's...
8
by: Swizylstik | last post by:
I'm a newbie to ASP and databases. I have created a simple contact list database and an asp page that shows the contact listing. So far so good. Here's what I have:...
2
by: kjosh | last post by:
Hi, i have created a script which reads records from an input file and then writes to multiple txt files based on one of the fields (from input file). While writing m getting blank lines between...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.