D
Daisyd
Hello
I'm trying to create a button on a form that when clicked automatically
mails a report. However, the tricky part is that I want that report to only
contain the data from the current record.
I am an Access amateur but have fudged together the following code where
"Bookingref" is the field that identifies the current and "Invoice
Instruction" is the report I want to mail.
Something's not quite working and I'm too much of an idiot to know what it is.
Private Sub Mail_Report_Click()
On Error GoTo Err_Mail_Report_Click
Dim stDocName As String
Dim MyWhereCondition As String
MyWhereCondition = "Bookingref= " & Me.Bookingref
stDocName = "Invoice Instruction"
DoCmd.SendObject acReport, stDocName, , MyWhereCondition
Exit_Mail_Report_Click:
Exit Sub
Err_Mail_Report_Click:
MsgBox Err.Description
Resume Exit_Mail_Report_Click
End Sub
I'm trying to create a button on a form that when clicked automatically
mails a report. However, the tricky part is that I want that report to only
contain the data from the current record.
I am an Access amateur but have fudged together the following code where
"Bookingref" is the field that identifies the current and "Invoice
Instruction" is the report I want to mail.
Something's not quite working and I'm too much of an idiot to know what it is.
Private Sub Mail_Report_Click()
On Error GoTo Err_Mail_Report_Click
Dim stDocName As String
Dim MyWhereCondition As String
MyWhereCondition = "Bookingref= " & Me.Bookingref
stDocName = "Invoice Instruction"
DoCmd.SendObject acReport, stDocName, , MyWhereCondition
Exit_Mail_Report_Click:
Exit Sub
Err_Mail_Report_Click:
MsgBox Err.Description
Resume Exit_Mail_Report_Click
End Sub