PC Review


Reply
Thread Tools Rate Thread

Binding Fields to Control Source

 
 
Nedan Nedzatra
Guest
Posts: n/a
 
      9th Jan 2010
Hia!

How are you doing friends?

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!

Thanks.
 
Reply With Quote
 
 
 
 
Marshall Barton
Guest
Posts: n/a
 
      9th Jan 2010
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]
 
Reply With Quote
 
Nedan Nedzatra
Guest
Posts: n/a
 
      11th Jan 2010
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]
> .
>

 
Reply With Quote
 
Marshall Barton
Guest
Posts: n/a
 
      12th Jan 2010
Nedan Nedzatra wrote:
>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.
>
>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
>


Your question about displaying a value in a text box on a
report should have nothing to do with how the report was
created and your code is extremely unusual. That kind of
code is for experts to use in creating a wizard and your
question implies that you are not an expert. Any other use
of CreateReport and CreateReportControl will cause all kinds
of problems so, unless you are are an expert creating a
design time wizard, what have been trying is NOT OK.

You have not explained the objective so we can not suggest
an appropriate way to achieve the goal. I can state that
you are definitely going about it the wrong way.

--
Marsh
MVP [MS Access]
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Facing problems in binding Control Source Public Microsoft Access Forms 6 27th May 2008 12:53 AM
Disabling source control binding in VS 2005? Clive Dixon Microsoft Dot NET 1 25th Apr 2007 04:53 AM
Binding data source parameters to the properties of the containing control Artem Ploujnikov Microsoft ASP .NET 0 30th Mar 2007 12:09 AM
Problems with binding to binding source on base form in VS 2005 =?Utf-8?B?SmltIFRpbHNvbg==?= Microsoft Dot NET Framework Forms 3 17th Oct 2006 12:19 PM
Source Control data binding to ActiveX control property Christopher Glaeser Microsoft Access Forms 10 17th Jan 2005 03:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:53 AM.