error 2427

C

colin

HI,
i have a private function to output a report based on the maximum of each
accno. However i would be grateful if someone could help me avoid the runtime
error by stopping all macros if the acc no is null and then displaying a
message box advising printing complete.
my code as it stands is as follows:

Private Sub Form_Load()

Dim FileName As String

FileName = [Forms]![PDFLimiter]![MaxOfAccNo] & "-" &
[Forms]![PDFLimiter]![Accountnumber] & ".pdf"

DoCmd.OutputTo acOutputReport, "Confirmation Letter PDF", acFormatPDF,
"W:\BACSFiles\PDFConfirmation\MDDC" & FileName, False
DoCmd.SetWarnings False
End Sub

Many thanks in anticipation
Colin
 
M

Maurice

How about:

if isnull(FileName = [Forms]![PDFLimiter]![MaxOfAccNo] & "-" &
[Forms]![PDFLimiter]![Accountnumber] & ".pdf") then

msgbox "please enter acc no first"
exit sub
end if


hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top