Hi,
I am creating a report at runtime, whose recordsource is SQL query. I can get a report all right, but in print preview mode it displays only three records per page in detail section. How do i print more records per page?
I have code like this.
strSqlQuery = "Select * from DishScores"
Set db = CurrentDb
lngLeft = 0
lngTop = 0
left = 0
DoCmd.OpenReport "Report1", acViewDesign
Set rpt = Reports("Report1"
With rpt
.RecordSource = strSqlQuery
.Caption = "TestTable Report"
.MenuBar = ""
End With
Set rstSource = db.OpenRecordset(strSqlQuery, dbOpenDynaset)
For Each fldData In rstSource.Fields
Set txtNew = CreateReportControl(rpt.Name, acTextBox, _
acDetail, , fldData.Name, lngLeft, lngTop, 1200, 700)
txtNew.TextAlign = 1
lngLeft = lngLeft + txtNew.Width + 25
Next
lngTop = lngTop + txtNew.Height+25
rstSource.Close
Set rstSource = Nothing
DoCmd.OpenReport rpt.Name, acViewPreview
I am creating a report at runtime, whose recordsource is SQL query. I can get a report all right, but in print preview mode it displays only three records per page in detail section. How do i print more records per page?
I have code like this.
strSqlQuery = "Select * from DishScores"
Set db = CurrentDb
lngLeft = 0
lngTop = 0
left = 0
DoCmd.OpenReport "Report1", acViewDesign
Set rpt = Reports("Report1"
With rpt
.RecordSource = strSqlQuery
.Caption = "TestTable Report"
.MenuBar = ""
End With
Set rstSource = db.OpenRecordset(strSqlQuery, dbOpenDynaset)
For Each fldData In rstSource.Fields
Set txtNew = CreateReportControl(rpt.Name, acTextBox, _
acDetail, , fldData.Name, lngLeft, lngTop, 1200, 700)
txtNew.TextAlign = 1
lngLeft = lngLeft + txtNew.Width + 25
Next
lngTop = lngTop + txtNew.Height+25
rstSource.Close
Set rstSource = Nothing
DoCmd.OpenReport rpt.Name, acViewPreview