F
Fredrated
I am trying to create an access report to print 1099-misc vendor tax reports
on laserjet forms, to replace the continous forms of the dot matrix printer
we have used up to now.
the form has 2 reports per page
Problem: if I try to create a 1/2 page report, hoping that 2 will print per
page, the problem is that the first form is impacted by the printer top
margin, which access will not let me set to zero. If I subtract the top
margin from the report, then the 2nd report to print on the page is off by
the amount of the margin.
So, I am atempting to create a one page report which will have text boxes in
the correct places for both forms, which I will fill with vba code during the
printing process.
To that effect, I so far have:
in the form which calls the report: (this is the 'proof of concept' code)
DoCmd.OpenReport "r1099laser"
Report_r1099Laser.Clear
Report_r1099Laser.idA = 1
Report_r1099Laser.idB = 2
Then in the report, I have the code:
Dim rs As Recordset
Dim strSQL As String
Dim idx As Long
Dim idy As Long
Public Sub Clear()
idx = 0
Me.name1 = Null
Me.addr1 = Null
Me.citystzip1 = Null
Me.box61 = Null
Me.box71 = Null
idy = 0
Me.name2 = Null
Me.addr2 = Null
Me.citystzip2 = Null
Me.box62 = Null
Me.box72 = Null
End Sub
Property Let idA(ByVal id As Long)
idx = id
End Property
Property Let idB(ByVal id As Long)
idy = id
End Property
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
strSQL = "SELECT TestData.* FROM TestData WHERE (((TestData.id)=" &
CStr(idx) & "));"
Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
rs.MoveFirst
Me.id1 = rs!tax_id
Me.name1 = rs!Name
Me.addr1 = rs!addr1
Me.citystzip1 = rs!citystzip
Me.box61 = rs!box6
Me.box71 = rs!box7
rs.Close
If idy <> 0 Then
strSQL = "SELECT TestDate4Records.* FROM TestDate4Records WHERE
(((TestDate4Records.id)=" & CStr(idy) & "));"
Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
rs.MoveFirst
Me.id2 = rs!tax_id
Me.name2 = rs!Name
Me.addr2 = rs!addr1
Me.citystzip2 = rs!citystzip
Me.box62 = rs!box6
Me.box72 = rs!box7
rs.Close
End If
rs.Close
Set rs = Nothing
End Sub
Results: I get a message box which says "Now printing r1099laser to the
printer..." etc., but in fact nothing goes to the queue, nothing comes out of
the printer!
Any ideas what I am missing here? Or alternately, how to solve this problem
in some other way?
Thanks in advance for any help.
Fred
on laserjet forms, to replace the continous forms of the dot matrix printer
we have used up to now.
the form has 2 reports per page
Problem: if I try to create a 1/2 page report, hoping that 2 will print per
page, the problem is that the first form is impacted by the printer top
margin, which access will not let me set to zero. If I subtract the top
margin from the report, then the 2nd report to print on the page is off by
the amount of the margin.
So, I am atempting to create a one page report which will have text boxes in
the correct places for both forms, which I will fill with vba code during the
printing process.
To that effect, I so far have:
in the form which calls the report: (this is the 'proof of concept' code)
DoCmd.OpenReport "r1099laser"
Report_r1099Laser.Clear
Report_r1099Laser.idA = 1
Report_r1099Laser.idB = 2
Then in the report, I have the code:
Dim rs As Recordset
Dim strSQL As String
Dim idx As Long
Dim idy As Long
Public Sub Clear()
idx = 0
Me.name1 = Null
Me.addr1 = Null
Me.citystzip1 = Null
Me.box61 = Null
Me.box71 = Null
idy = 0
Me.name2 = Null
Me.addr2 = Null
Me.citystzip2 = Null
Me.box62 = Null
Me.box72 = Null
End Sub
Property Let idA(ByVal id As Long)
idx = id
End Property
Property Let idB(ByVal id As Long)
idy = id
End Property
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
strSQL = "SELECT TestData.* FROM TestData WHERE (((TestData.id)=" &
CStr(idx) & "));"
Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
rs.MoveFirst
Me.id1 = rs!tax_id
Me.name1 = rs!Name
Me.addr1 = rs!addr1
Me.citystzip1 = rs!citystzip
Me.box61 = rs!box6
Me.box71 = rs!box7
rs.Close
If idy <> 0 Then
strSQL = "SELECT TestDate4Records.* FROM TestDate4Records WHERE
(((TestDate4Records.id)=" & CStr(idy) & "));"
Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
rs.MoveFirst
Me.id2 = rs!tax_id
Me.name2 = rs!Name
Me.addr2 = rs!addr1
Me.citystzip2 = rs!citystzip
Me.box62 = rs!box6
Me.box72 = rs!box7
rs.Close
End If
rs.Close
Set rs = Nothing
End Sub
Results: I get a message box which says "Now printing r1099laser to the
printer..." etc., but in fact nothing goes to the queue, nothing comes out of
the printer!
Any ideas what I am missing here? Or alternately, how to solve this problem
in some other way?
Thanks in advance for any help.
Fred