Log in

View Full Version : Solved: Mail Report help



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

Oorang
02-18-2008, 12:34 PM
I see you marked this solved. What was the solution you used?

Trevor
02-18-2008, 01:50 PM
i used a report with the form size the same as the evelope, and placed a labled where the to address should go and gave it a caption just as a place holder, then send my other text fields to that lable

Ie:
Dim R as report
Dim R = Report!test
R![ Mail labele].caption = Me.To & vbnewline & _
Me.Adderess & vbnewline & _
Me.City & Chr$(32) & Me.state & Chr$(32) Me. zipcode
End Sub
Note* chr$(32) should be ascii space (but Im doin this off the top of my head, I havn't tested this yet on a printer, because I want to get the rest of my DB working- witch is 4-5 forms and this is only part of 1 of them)