Solved

Skipping a line for null data

Posted on 2012-12-21
5
264 Views
Last Modified: 2013-03-06
I am creating a report in Access to show a list of Contact Names, addresses, phone #s, etc.  I have 2 lines for Address and then Address2 and I am trying to not have a blank line show for people who do not have an Address2.  I'm sure this is simple I just forgot how to do it.
0
Comment
Question by:apsonline
5 Comments
 
LVL 4

Expert Comment

by:rshq
ID: 38713981
Hi
 Maybe you can use shrink.
0
 
LVL 61

Assisted Solution

by:mbizup
mbizup earned 167 total points
ID: 38714540
The Can Shrink property for your Address2 textbox will work provided that you don't have any controls next to that textbox.  If you do have any other controls horizontally lined up with it, the Can Shrink property will not work.

To avoid problems with skipped lines, I generally use one textbox for both address lines, and set it's control source property as follows (including the = sign):

= Address & iif("" & Address2 = "", "", Chr(13) & Chr(10)  & Address2)

Open in new window


If
0
 
LVL 29

Accepted Solution

by:
IrogSinta earned 167 total points
ID: 38714942
Try this expression in a textbox:
=[LName] & ', '+[FName] & '
'+[Address1] & '
'+[Address2] & '
'+[City] & ', '+[State] & ' '+[Zip] & '
'+'Home: '+[HomePhone] & '
'+'Cell: '+[CellPhone]


At the end of each line (after each single quote), add a carriage return using CTRL+ENTER.  The + sign concatenates the fields and if a field is null it erases any concatenated strings including carriage returns.  So if the only fields with data were First & Last Name, City, and CellPhone, it would show up as:

Skywalker, Luke
San Diego
Cell: 123-456-7890


You can learn more about this concatenation style form harfang's article:
Concatenation in Access Reports (and Forms)
0
 
LVL 31

Assisted Solution

by:Helen_Feddema
Helen_Feddema earned 166 total points
ID: 38716081
The best thing (though maybe not practical at this point) would be to eliminate the Address2 field entirely.  There is no need for a field for each line of an address, since you can enter multiple address lines into one field in Access.  If that is not practical, you can use something like the following in a query expression:

Address: IIf(Nz([Address2])<>"",[Address1] & Chr(13) & Chr(10) & [Address2],[Address1])
0
 

Author Closing Comment

by:apsonline
ID: 38959414
I tried all three of these and they all worked somewhat, however the =Trim command, which was not suggested worked best.  Thanks to everyone for their efforts.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now