Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / December 2005

Tip: Looking for answers? Try searching our database.

Createreportcontrol confusion for dynamic adding of textboxes/labe

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve G - 30 Nov 2005 23:01 GMT
I want to give the user the ability to add 1 to 3 new fields to a report.  
When I run the code below, I find that the detail is okay. The problem is
with the headers and footers in the report.  Nothing is being placed in the
section that I code.
HELP!

the code:
'**********
Cnt + 1                                   'tally of fields chosen
      Select Case ctl.NAME
        Case "chkSelect1"                          'Outbound column
           Set ctlLabel = CreateReportControl(RptName, acLabel,
acGroupLevel1Header, "", "", (8250 + (770 * Cnt)), 660, 750, 663)
            ctlLabel.Caption = "Outbound Calls TalkTime"
            ctlLabel.NAME = "lblAdd" & Cnt
            ctlLabel.TextAlign = 2
            ctlLabel.FontSize = 8
          Set ctlText = CreateReportControl(RptName, acTextBox, acDetail,
"", "DNoutExtCallsTalkTime", (8250 + (770 * Cnt)), 240, 375, 270)
            ctlText.NAME = "txtDailyA" & Cnt
            ctlText.TextAlign = 2
            ctlText.FontSize = 8
          Set ctlText = CreateReportControl(RptName, acTextBox, acDetail,
"", "DNoutIntCallsTalkTime", (8625 + (770 * Cnt)), 240, 375, 270)
           ctlText.NAME = "txtDailyB" & Cnt
           ctlText.TextAlign = 2
           ctlText.FontSize = 8
                     
      Case "chkSelect2"                           'Inbound column
         Set ctlText = CreateReportControl(RptName, acTextBox, acDetail,
"", "DNInExtCalls", (8250 + (770 * Cnt)), 240, 375, 270)
          ctlText.NAME = "txtDailyA" & Cnt
          ctlText.TextAlign = 2
          ctlText.FontSize = 8
         Set ctlText = CreateReportControl(RptName, acTextBox, acDetail,
"", "DNInIntCalls", (8625 + (770 * Cnt)), 240, 375, 270)
          ctlText.NAME = "txtDailyB" & Cnt
          ctlText.TextAlign = 2
          ctlText.FontSize = 8
        Set ctlLabel = CreateReportControl(RptName, acLabel,
acGroupLevel1Header, "", "", (8250 + (770 * Cnt)), 660, 750, 663)
          ctlLabel.Caption = "Inbound Calls TalkTime"
          ctlLabel.NAME = "lblAdd" & Cnt
          ctlLabel.TextAlign = 2
          ctlLabel.FontSize = 8
           
     Case "chkSelect3"                           'Talk Time column
        Set ctlText = CreateReportControl(RptName, acTextBox, acDetail, "",
"TalkTime(min)", (8250 + (770 * Cnt)), 240, 750, 270)
          ctlText.NAME = "txtDaily" & Cnt
          ctlText.TextAlign = 2
          ctlText.FontSize = 8
        Set ctlLabel = CreateReportControl(RptName, acLabel,
acGroupLevel1Header, "", "", (8250 + (770 * Cnt)), 660, 750, 663)
          ctlLabel.Caption = "         TalkTime (min)"
          ctlLabel.NAME = "lblAdd" & Cnt
          ctlLabel.TextAlign = 2
          ctlLabel.FontSize = 8
        Set ctlText = CreateReportControl(RptName, acTextBox,
acGroupLevel1Footer, "", "=Sum([TalkTime(min)])", (8250 + (770 * Cnt)), 930,
750, 270)
          ctlText.NAME = "txtTot" & Cnt
          ctlText.TextAlign = 2
          ctlText.FontSize = 8
        Set ctlLabel = CreateReportControl(RptName, acLabel,
acGroupLevel1Footer, ctlText.NAME, "", (8250 + (770 * Cnt)), 465, 750, 465)
          ctlLabel.Caption = "Total TalkTime"
          ctlLabel.NAME = "lblTot" & Cnt
          ctlLabel.TextAlign = 2
          ctlLabel.FontSize = 8
          If AssocSkill = "coach" Then
             Set ctlText = CreateReportControl(RptName, acTextBox,
acGroupLevel2Footer, "", "=Sum([TalkTime(min)])", (8250 + (770 * Cnt)), 930,
750, 270)
               ctlText.NAME = "txtTotC3"
               ctlText.TextAlign = 2
               ctlText.FontSize = 8
             Set ctlLabel = CreateReportControl(RptName, acLabel,
acGroupLevel2Footer, ctlText.NAME, "", (8250 + (770 * Cnt)), 465, 750, 465)
               ctlLabel.Caption = "Total TalkTime"
               ctlLabel.NAME = "lblTotC3"
               ctlLabel.TextAlign = 2
               ctlLabel.FontSize = 8
          End If
'*********
Marshall Barton - 01 Dec 2005 00:37 GMT
You're barking up the wrong tree??

CreateControl should only be used in a design time wizard,
not in a runtim procedure.

A far better way to accomplish the goal is to add the
controls at design time and make them visible/invisible as
needed at runtime.
Signature

Marsh
MVP [MS Access]

>I want to give the user the ability to add 1 to 3 new fields to a report.  
>When I run the code below, I find that the detail is okay. The problem is
[quoted text clipped - 81 lines]
>           End If
>'*********
Steve G - 01 Dec 2005 14:17 GMT
In the earilier code, I open the report in design view and hidden, then run
the code that you read.  I want to be able to left justify any of the columns
that are selected.
When you design all of the columns and then make the selected ones visible,
then you can have column gaps in the preview of the report.  This is why I
did what I did.....

thanks for the comments.

> You're barking up the wrong tree??
>
[quoted text clipped - 89 lines]
> >           End If
> >'*********
Duane Hookom - 01 Dec 2005 14:23 GMT
It's much easier to set the Left (and other) property at run time than it is
to create controls from scratch.

Signature

Duane Hookom
MS Access MVP
--

> In the earilier code, I open the report in design view and hidden, then
> run
[quoted text clipped - 113 lines]
>> >           End If
>> >'*********
Marshall Barton - 01 Dec 2005 15:28 GMT
What Duane said.

You have already calculated the control's Left property in
your CreateControl procedure, so, instead of calling
CreateControl, just set an existing text box's Left
property.
Signature

Marsh
MVP [MS Access]

>In the earilier code, I open the report in design view and hidden, then run
>the code that you read.  I want to be able to left justify any of the columns
[quoted text clipped - 29 lines]
>> >             ctlLabel.TextAlign = 2
>> >             ctlLabel.FontSize = 8
[snip]
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.