J
jameswfrost
Hi,
I'm attempting to fix some problems in an Access database that was
created by somebody else. It's used solely for printing reports for
records from an external database.
The Access database I'm editing a module named DAOPrintFunctions - I'm
not sure where it came from, but I presume it wasn't written by the
person who put together the Access application. This is where the
trouble lies.
When you print a report, the DAOPrintFunctions module prints the first
page of the report on letterheaded paper (from tray 1 of our printer)
and the remaining pages on blank paper (from tray 2). DAOPrintFunctions
has a function named TwoBinPrint, which is used to do this.
However, if the report has only one page, DAOPrintFunctions still tries
to print the remaining pages. This results in a blank page being
printed between single page reports. The blank page contains nothing
except the letters IB in the top corner. As the majority of reports we
print are single page, this creates a lot of extra work as we have to
manually remove all the blank pages.
I've narrowed down the error to this section of code:
If intDlgReturn = True Then
DoCmd.SelectObject acReport, strRptName
If FirstPage = True Then
DoCmd.PrintOut acPages, 1, 1, , intPassCopies, -1
Else
DoCmd.PrintOut acPages, 2, 9999, , intPassCopies, -1
End If
End If
So I tried inserting an IF to check whether there was more than one
page in the report. If there was, I told it to print. However, I can't
get this to work. I added:
"If Reports(strRptName).Pages > 1 Then" before the line "DoCmd.PrintOut
acPages, 2, 9999, , intPassCopies, -1"
I'm getting an error on the 'Reports(strRptName).Pages' section, saying
"You have entered an an expression that has an invalid reference". And
before you ask, I have added a textbox into the Footer of the report
with the control source =[Pages].
So, after all that - does anybody have any idea why I can't use the
pages variable? Or how I could sort this problem?
I hope someone can help,
Thanks,
James Frost
I'm attempting to fix some problems in an Access database that was
created by somebody else. It's used solely for printing reports for
records from an external database.
The Access database I'm editing a module named DAOPrintFunctions - I'm
not sure where it came from, but I presume it wasn't written by the
person who put together the Access application. This is where the
trouble lies.
When you print a report, the DAOPrintFunctions module prints the first
page of the report on letterheaded paper (from tray 1 of our printer)
and the remaining pages on blank paper (from tray 2). DAOPrintFunctions
has a function named TwoBinPrint, which is used to do this.
However, if the report has only one page, DAOPrintFunctions still tries
to print the remaining pages. This results in a blank page being
printed between single page reports. The blank page contains nothing
except the letters IB in the top corner. As the majority of reports we
print are single page, this creates a lot of extra work as we have to
manually remove all the blank pages.
I've narrowed down the error to this section of code:
If intDlgReturn = True Then
DoCmd.SelectObject acReport, strRptName
If FirstPage = True Then
DoCmd.PrintOut acPages, 1, 1, , intPassCopies, -1
Else
DoCmd.PrintOut acPages, 2, 9999, , intPassCopies, -1
End If
End If
So I tried inserting an IF to check whether there was more than one
page in the report. If there was, I told it to print. However, I can't
get this to work. I added:
"If Reports(strRptName).Pages > 1 Then" before the line "DoCmd.PrintOut
acPages, 2, 9999, , intPassCopies, -1"
I'm getting an error on the 'Reports(strRptName).Pages' section, saying
"You have entered an an expression that has an invalid reference". And
before you ask, I have added a textbox into the Footer of the report
with the control source =[Pages].
So, after all that - does anybody have any idea why I can't use the
pages variable? Or how I could sort this problem?
I hope someone can help,
Thanks,
James Frost