Trevor
02-10-2008, 03:51 PM
I am trying to set up a report to print envelops with mailing addresses
and i'm getting an error - "object Required", when the report opens and all of the required fields are populated
the form im pulling from is "vmsu-Ml", the report name is "ReportTest2",
I have tried both Dim M as report and as form and I get the same error either way, in both cases the report does open and give me ther error "object required"
here is my code;
Private Sub reptest_Click()
On Error GoTo Err_reptest_Click
Dim stDocName As String
stDocName = "ReportTest2"
DoCmd.OpenReport stDocName, acPreview
Dim M As Report
Set M = Report![ReportTest2]
M![MailAddress] = Me![To] & vbNewLine & Me![To Adddress] & vbNewLine & Me![To City] & "," & _
Me![To State] & Me![To Zip Code]
Exit_reptest_Click:
Exit Sub
Err_reptest_Click:
MsgBox Err.Description
Resume Exit_reptest_Click
End Sub
and i'm getting an error - "object Required", when the report opens and all of the required fields are populated
the form im pulling from is "vmsu-Ml", the report name is "ReportTest2",
I have tried both Dim M as report and as form and I get the same error either way, in both cases the report does open and give me ther error "object required"
here is my code;
Private Sub reptest_Click()
On Error GoTo Err_reptest_Click
Dim stDocName As String
stDocName = "ReportTest2"
DoCmd.OpenReport stDocName, acPreview
Dim M As Report
Set M = Report![ReportTest2]
M![MailAddress] = Me![To] & vbNewLine & Me![To Adddress] & vbNewLine & Me![To City] & "," & _
Me![To State] & Me![To Zip Code]
Exit_reptest_Click:
Exit Sub
Err_reptest_Click:
MsgBox Err.Description
Resume Exit_reptest_Click
End Sub