PC Review


Reply
Thread Tools Rate Thread

Re: Printing blanks

 
 
Wolfgang Badura
Guest
Posts: n/a
 
      25th Sep 2011
Hallo!
"mickiehick" <(E-Mail Removed)> schrieb im Newsbeitrag
news:85aa3b3d-49de-418b-b3db-(E-Mail Removed)...
>I have a macro assigned to a button that prints a number of reports
> based on "Due Dates". Some of these reports are often blank and I tend
> to be wasting a lot of paper. Is there a way that I can print only the
> reports with records shown without having to open each one first to
> check? There are a total of 9 reports and they are printed daily.
>
> Appreciate any help offered.


Check the Number of records of the Query or Table.

'
' Ermittelt die Recordanzahl von Tabellen oder Abfragen
' returns -1 bei Programmfehler
'
Function RecCount(ByVal Objekt As Variant) As Long
On Error GoTo RecCountErr
Dim RS As DAO.Recordset
Dim retc As Long

retc = True
If bTest Then Debug.Print "Function RecCount, Objekt=" & Objekt
Set RS = CurrentDb.OpenRecordset(Objekt, DB_OPEN_SNAPSHOT)
RS.MoveLast
retc = RS.RecordCount
EndRecCount:
On Error Resume Next
RS.Close: Set RS = Nothing
RecCount = retc
Exit Function

RecCountErr:
Resume EndRecCount
End Function

In the Macro condition you should check

RecCount("YourObject")>0

before printing.

Wolfgang


 
Reply With Quote
 
 
 
 
mickiehick
Guest
Posts: n/a
 
      25th Sep 2011
On Sep 25, 11:07*am, "Wolfgang Badura" <WolfgangBad...@aon.at> wrote:
> Hallo!
> "mickiehick" <mickieh...@gmail.com> schrieb im Newsbeitragnews:85aa3b3d-49de-418b-b3db-(E-Mail Removed)...
>
> >I have a macro assigned to a button that prints a number of reports
> > based on "Due Dates". Some of these reports are often blank and I tend
> > to be wasting a lot of paper. Is there a way that I can print only the
> > reports with records shown without having to open each one first to
> > check? There are a total of 9 reports and they are printed daily.

>
> > Appreciate any help offered.

>
> Check the Number of records of the Query or Table.
>
> '
> ' Ermittelt die Recordanzahl von Tabellen oder Abfragen
> ' returns -1 bei Programmfehler
> '
> Function RecCount(ByVal Objekt As Variant) As Long
> * *On Error GoTo RecCountErr
> * *Dim RS As DAO.Recordset
> * *Dim retc As Long
>
> * *retc = True
> * *If bTest Then Debug.Print "Function RecCount, Objekt=" & Objekt
> * *Set RS = CurrentDb.OpenRecordset(Objekt, DB_OPEN_SNAPSHOT)
> * *RS.MoveLast
> * *retc = RS.RecordCount
> EndRecCount:
> * *On Error Resume Next
> * *RS.Close: Set RS = Nothing
> * *RecCount = retc
> * *Exit Function
>
> RecCountErr:
> * *Resume EndRecCount
> End Function
>
> In the Macro condition you should check
>
> RecCount("YourObject")>0
>
> before printing.
>
> Wolfgang


Thanks Wolfgang

I'll give this a try and let you know how I get on.

Cheers
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy range of cells with blanks then paste without blanks =?Utf-8?B?anVzdGFndXlmcm9ta3k=?= Microsoft Excel Programming 5 3rd Sep 2006 11:23 PM
copy range of cells with blanks then paste without blanks =?Utf-8?B?anVzdGFndXlmcm9ta3k=?= Microsoft Excel Worksheet Functions 1 3rd Sep 2006 07:56 PM
Adding 'Blanks' & 'Non-blanks' to a filter combo box Robin Microsoft Access VBA Modules 2 2nd Aug 2006 05:48 PM
Paste Special Skip Blanks not skipping blanks, but overwriting... =?Utf-8?B?Z3Nyb3Npbg==?= Microsoft Excel Misc 0 22nd Feb 2005 04:33 AM
Logic of xlCellTypeBlanks i.e. "Blanks" period or "Blanks" in used range? Dennis Microsoft Excel Misc 8 9th Apr 2004 10:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:27 AM.