Hia!
Marshall!
I think what I have been trying is OK!
If my communication was misleading or have I added unnecessary lines of
codes I am sorry.
Thanks!
Sub NewControlsReports()
Dim rpt As Report
Dim intDataX As Integer, intDataY As Integer
Set rpt = CreateReport
rpt.RecordSource = "SELECT [Contacts].Notes FROM [Contacts]"
intDataX = 2000
intDataY = 100
Set ctlText = CreateReportControl(rpt.Name, acTextBox, , "", "", _
intDataX, intDataY)
rpt(ctlText.Name).ControlSource = "Notes"
DoCmd.RunCommand acCmdReportView
End Sub
"Marshall Barton" wrote:
> Nedan Nedzatra wrote:
> >I am not able to populate the Text Box in the report!
> >
> >Sub NewControlsReports()
> > Dim rpt As Report
> > Dim ctlLabel As Control, ctlText As Control
> > Dim intDataX As Integer, intDataY As Integer
> >
> > Set rpt = CreateReport
> >
> > rpt.RecordSource = "Contacts"
> >
> > intDataX = 2000
> > intDataY = 100
> >
> > Set ctlText = CreateReportControl(rpt.Name, acTextBox, , "", "", _
> > intDataX, intDataY)
> >
> > ctlText.ControlSource = "Notes" '''''I''''' am not sure how to put it here
> >
> > DoCmd.Restore
> >End Sub
> >
> >
> >'Notes' is the field containing data in the table 'Contacts'. This is a
> >report from a table not from a query. Could someone please correct me!
>
>
> You are way off base by trying to use CreateReport and
> CreateReportControl. Just create the report manually in
> design view or, if it does what you want, use an appropriate
> report wizard.
>
> FYI, Those two methods should only be used when you want to
> create your own design time wizard kind of thing. They
> should not be used in a running application.
>
> --
> Marsh
> MVP [MS Access]
> .
>
|