Solved

How do I remove blank lines in Access reports with CanShrink function?

Posted on 2011-03-13
4
1,739 Views
Last Modified: 2012-06-22
Hello there,

  We have been having a lot of trouble implementing a CanShrink function into an Access database of names and addresses.  Despite repeated attempts we are getting blank lines showing up in the reports where the information is missing, even though we have tried to stop the problem with a limiting IFNULL and a CanShrink function.

  We would like to have a clean Report come out of the database which has no blanks in the displayed info.  (except of course for the spacing between each record).

  Hopefully in the file you will see where these blank lines are showing up - we just want them gone so that the information per person is tightened up.

  Is there a distinction between doing something like this in Access 2003 vs. 2010?  I am hoping not since the database needs to be used in both versions.

  I am totally lost in Access and even more-so with these functions.  Anyone out there able to solve this one?

  I am attaching the Access database file and a sample of the excel mailing list which contains the info (blank fields and all) which it is trying to organize.  The excel file is called "Annuaire 50 NAME TEST OF BLANKS", which I think is Sheet 1 in the database, and the access file is just db1.

  Feel free to insert the proper function/macro/if-statements/whatever-it-is-called in order to solve this one.  Honestly, I can't even locate where it is put in anymore or where to find it in Access.

I shall await patiently. Annuaire-50-NAME-TEST-OF-BLANKS.xls db1.mdb
0
Comment
Question by:jayxx2
  • 2
  • 2
4 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
try this function

Public Function CanShrinkLines(ParamArray arrLines())
' Pass this function the lines to be combined
' For example: strAddress =
' CanShrinkLines(Name, Address1, Address2, City, St, Zip, Country)
Dim x As Integer, strLine As String
  For x = 0 To UBound(arrLines)
  arrLines(x) = Trim(arrLines(x))    '<<< insert this line
    If Not IsNull(arrLines(x)) And arrLines(x) & "" <> "" Then  '<< revised line
      strLine = strLine & arrLines(x) & vbCrLf
    End If
  Next
  CanShrinkLines = strLine
End Function

Open in new window

0
 

Author Comment

by:jayxx2
Comment Utility
I'd love to try it out - Can you give me some basic instructions on how/where to put it in?  

I have taken over this database problem from scratch and as mentioned in my original plea for help, have no idea where to even place it or run it.
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
Comment Utility
there is a function named "CanShrinkLines" located in module named MainModule

here is the revised db
db1rev.mdb
0
 

Author Closing Comment

by:jayxx2
Comment Utility
My thanks for the prompt work!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server functions 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 Ac…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

12 Experts available now in Live!

Get 1:1 Help Now