B
Brian
Hello all, I am new to creating a dynamic reports and this is I hope a 1
time need. The table I have below is created dynamically the only
things that are constants would be DBH and FLAG.. the other columns
could be anything and any number of them. My question is I want this to
be reflected on a dynamic report as well.. I have the code below where I
have started but a few questions I have is
1. my recordsource does not estatblish
2. Anyone got an example of how to create the column headers which i am
sure would have to be in a loop and textbox.
3. How to preview the report and then close it without prompt for save
DBH 316 318 743 833 951 Flag
6 2.5 5 0
8 5 7.5 2.5 2.5 0
10 5 5 0
12 7.5 7.5 0
14 5 2.5 2.5 2.5 0
16 2.5 2.5 0
18 12.5 0
20 5 0
22 0
24 2.5 0
Sub NewReport()
Dim rpt As Report
Dim ctlLabel As Control, ctlText As Control
Dim intDataX As Integer, intDataY As Integer
Dim intLabelX As Integer, intLabelY As Integer
intLabelX = 100
intLabelY = 100
intDataX = 1000
intDataY = 100
Set rpt = CreateReport
rpt.RecordSource = "tblStand"
'Open in Design
DoCmd.OpenReport "rpt", acViewDesign
Set ctlText = CreateReportControl("rpt", acTextBox, acDetail, "", "", _
intDataX, intDataY)
ctlText.Name = "txtSpc"
Set ctlLabel = CreateReportControl("rpt", acLabel, , ctlText.Name, _
"TEXTSPC1", intLabelX, intLabelY)
' Restore new report.
DoCmd.Restore
DoCmd.RepaintObject
DoCmd.OpenReport "rpt", acViewPreview
time need. The table I have below is created dynamically the only
things that are constants would be DBH and FLAG.. the other columns
could be anything and any number of them. My question is I want this to
be reflected on a dynamic report as well.. I have the code below where I
have started but a few questions I have is
1. my recordsource does not estatblish
2. Anyone got an example of how to create the column headers which i am
sure would have to be in a loop and textbox.
3. How to preview the report and then close it without prompt for save
DBH 316 318 743 833 951 Flag
6 2.5 5 0
8 5 7.5 2.5 2.5 0
10 5 5 0
12 7.5 7.5 0
14 5 2.5 2.5 2.5 0
16 2.5 2.5 0
18 12.5 0
20 5 0
22 0
24 2.5 0
Sub NewReport()
Dim rpt As Report
Dim ctlLabel As Control, ctlText As Control
Dim intDataX As Integer, intDataY As Integer
Dim intLabelX As Integer, intLabelY As Integer
intLabelX = 100
intLabelY = 100
intDataX = 1000
intDataY = 100
Set rpt = CreateReport
rpt.RecordSource = "tblStand"
'Open in Design
DoCmd.OpenReport "rpt", acViewDesign
Set ctlText = CreateReportControl("rpt", acTextBox, acDetail, "", "", _
intDataX, intDataY)
ctlText.Name = "txtSpc"
Set ctlLabel = CreateReportControl("rpt", acLabel, , ctlText.Name, _
"TEXTSPC1", intLabelX, intLabelY)
' Restore new report.
DoCmd.Restore
DoCmd.RepaintObject
DoCmd.OpenReport "rpt", acViewPreview