marcello62
Technical User
Hello,
I design a report using the following code:
'begin
Dim txtNew As Access.TextBox
Dim labNew As Access.Label
Dim lngTop As Long
Dim lngLeft As Long
Dim lblCol As Long
Dim rpt As Report
Dim strSql As String
Dim db As Database
Dim rs As Recordset
Dim i As Integer
Dim prevColwidth As Long
Set db = CurrentDb()
lngLeft = 0
lngTop = 0
DoCmd.OpenReport "rptOverzicht", acViewDesign
Set rpt = Reports![rptOverzicht]
strSql = "SELECT * FROM tmpOverzicht; "
Set rs = db.OpenRecordset(strSql)
rpt.RecordSource = strSql
prevColwidth = 0
lblCol = 0
For i = 0 To rs.Fields.Count - 1
Set labNew = CreateReportControl(rpt.Name, acLabel, acPageHeader, , rs.Fields(i).Name, lblCol, , , lngTop)
labNew.SizeToFit
lblCol = lblCol + 600 + labNew.Width
Next
For i = 0 To rs.Fields.Count - 1
Set txtNew = CreateReportControl(rpt.Name, acTextBox, acDetail, , , lngLeft + 15 + prevColwidth, lngTop)
txtNew.SizeToFit
txtNew.TextAlign = 1
txtNew.ControlSource = rs(i).Name
prevColwidth = prevColwidth + txtNew.Width
Next
DoCmd.OpenReport "rptOverzicht", acViewPreview
'end
It works, but the space between the lines in the report is too big, I want to reduce it so that I can print more lines on one page. Does anyone know how to do this?
Thanks.
I design a report using the following code:
'begin
Dim txtNew As Access.TextBox
Dim labNew As Access.Label
Dim lngTop As Long
Dim lngLeft As Long
Dim lblCol As Long
Dim rpt As Report
Dim strSql As String
Dim db As Database
Dim rs As Recordset
Dim i As Integer
Dim prevColwidth As Long
Set db = CurrentDb()
lngLeft = 0
lngTop = 0
DoCmd.OpenReport "rptOverzicht", acViewDesign
Set rpt = Reports![rptOverzicht]
strSql = "SELECT * FROM tmpOverzicht; "
Set rs = db.OpenRecordset(strSql)
rpt.RecordSource = strSql
prevColwidth = 0
lblCol = 0
For i = 0 To rs.Fields.Count - 1
Set labNew = CreateReportControl(rpt.Name, acLabel, acPageHeader, , rs.Fields(i).Name, lblCol, , , lngTop)
labNew.SizeToFit
lblCol = lblCol + 600 + labNew.Width
Next
For i = 0 To rs.Fields.Count - 1
Set txtNew = CreateReportControl(rpt.Name, acTextBox, acDetail, , , lngLeft + 15 + prevColwidth, lngTop)
txtNew.SizeToFit
txtNew.TextAlign = 1
txtNew.ControlSource = rs(i).Name
prevColwidth = prevColwidth + txtNew.Width
Next
DoCmd.OpenReport "rptOverzicht", acViewPreview
'end
It works, but the space between the lines in the report is too big, I want to reduce it so that I can print more lines on one page. Does anyone know how to do this?
Thanks.