Solved

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

Posted on 2011-03-13
4
1,791 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 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35123418
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
ID: 35123522
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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 35123543
there is a function named "CanShrinkLines" located in module named MainModule

here is the revised db
db1rev.mdb
0
 

Author Closing Comment

by:jayxx2
ID: 35123628
My thanks for the prompt work!
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

821 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