Sabtu, 25 Februari 2012

Re: [MS_AccessPros] creating controls in code

 

Hi Walter,

I agree with Duane on creating extra controls and hiding them -- then you can reposition them if needed.  If, however, you need to make new controls, here is a start for you:

dim ctl As Control

Set ctl = CreateControl(FormName, ControlType, Section, Parent, ColumnName, Left, Top, Width, Height)
ctl.Name = "controlname"
ctl.property  = "value" ... etc

'~~~~~~~~~~~~~~~~~~

ControlType --> acTextBox

Likewise, there is a CreateReportControl method

____________________
if you do not know how many columns you will need, what about using a query for your subreport?

Warm Regards,
Crystal

Microsoft MVP
remote training - learn while we get your project done!

Access Basics by Crystal
http://www.AccessMVP.com/strive4peace
Free 100-page book that covers essentials in Access

 *
   (: have an awesome day :)
 *

________________________________
From: Duane Hookom <duanehookom@hotmail.com>
To: ms_access_professionals@yahoogroups.com
Sent: Friday, February 24, 2012 11:03 PM
Subject: RE: [MS_AccessPros] creating controls in code

I would have a lot of hidden text boxes and make them visible as needed. I think there may be a better method but we don't know much about your requirements.

To: MS_Access_Professionals@yahoogroups.com
From: wgriffin48@mchsi.com
Date: Sat, 25 Feb 2012 01:01:33 +0000
Subject: [MS_AccessPros] creating controls in code

     
      Hello Group;

I am trying to format a report that has an unknown number of textboxes to head an similarly unknown number of columns. So I am trying to use the "NEW" keyword to create textboxes on the fly.

Dim txtNB1() As TextBox

With rst1

            If strNB1 <> !Symbol Then

                If !strTrainDirection = "Northbound" And !strTrainClass = "1st" Then

                    strNB1 = !Symbol

                    NB1 = NB1 + 1

                    Set txtNB1(NB1) = New txtNB1

                    Me.txtNB1(NB1).Text = !Symbol

                End If

            End If

etc........

How do I get this to work? and assign values to the new textbox properties?

Walter Griffin

   
   

   
   

 

                       

[Non-text portions of this message have been removed]

------------------------------------

Yahoo! Groups Links

[Non-text portions of this message have been removed]

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar