Printing BLANK report for current form

N

Noone

I am trying to print a report for a current form which has just been
filled out.

However, unless I leave the current form and return to it, the report
prints blank.

Here is the code:

_______


Private Sub PrintVoucherSingle_Click()

'Print current record
'using rptlIndividualTaxiCertificates
If IsNull(Me!CertNumber) Then
MsgBox "Please select a valid record", _
vbOKOnly, "Error"
Exit Sub
End If

DoCmd.OpenReport "rptlIndividualTaxiCertificates", , , _
"CertNumber = " & Me!CertNumber

End Sub

__________________________________

What have I left out?

Tahnk you
 
R

Rob Parker

You need to save the record before the report runs. The easiest way is to
simply set Me.Dirty = False.

And I'd suggest a slight modification to your code design, to eliminate
multiple exit points form your Sub, thus:

Private Sub PrintVoucherSingle_Click()
'Print current record
'using rptlIndividualTaxiCertificates
If IsNull(Me!CertNumber) Then
MsgBox "Please select a valid record", _
vbOKOnly, "Error"
Else
Me.Dirty = False
DoCmd.OpenReport "rptlIndividualTaxiCertificates", , , _
"CertNumber = " & Me!CertNumber
End If
End Sub


HTH,

Rob
 

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