Senin, 27 Februari 2012

[MS_AccessPros] Re: creating controls in code

 

The requirement to be in design view is one of the reasons we all suggested you create a bunch of hidden controls.

Do you understand that you don't have to have any controls if you simply want to display short text and/or lines in your report?

Duane Hookom
MS Access MVP


--- In MS_Access_Professionals@yahoogroups.com, "nkpberk" <wgriffin48@...> wrote:
>
> Andy,Crystal;
> I tried the "createreportcontrol" and it requires the report be in "design" mode, have no idea how to run code when the report is in design mode.
> and the url about control arrays doesn't work, it refers to "Me.Controls.Add" there is no "add" function in VBA for access.
> Still Stumped.
> Walter
>
> --- In MS_Access_Professionals@yahoogroups.com, "nkpberk" <wgriffin48@> wrote:
> >
> > Andy,Crystal,everyone;
> > Predefining controls is kinda not practical, as I develop this form and/or report I could have a lot of columns (a friend has almost 50, but his expertize is Excel, retired pro) and as many rows. columns sorted by direction North/South or East/West and class 1st, 2nd & 3rd
> > This is a train schedule. I have figured how to determine the number of "Northbound" 1st class trains etc... and I need to create textboxes to head the columns for each train with the name/number of the train and then apply the arrival/departure times for each train in more textboxes below the header textbox (could end up with over a 1000 textboxes for a large model railroad).
> > Andy, The control array limitation is why I don't use VB.net when I code for real time I/O applications as I need control arrays for the virtual levers, lamps ,switches etc.. for screen controls to drive/respond to input and output of/from motors, leds, push buttons etc.. all the hardware is indexed to the indexes on the screen controls. I could do it VB.nets way but I would have to write a boatload more code and it would really impact performance. MS, once more deciding whats best for everyone else without asking!
> > Walter
> >
> > --- In MS_Access_Professionals@yahoogroups.com, "acravenrohm" <yahoo@> wrote:
> > >
> > > Well, Walter, VBA doesn't allow you to create Control Arrays as you can in VB6 so this isn't going to work.
> > >
> > > There are ways to work around this for Forms, maybe the techniques will work for Reports as well, I haven't tried it.
> > >
> > > http://siddharthrout.wordpress.com/2011/08/05/vba-control-arrays/
> > >
> > > Generally, it's not worth the effort to play clever games with reports as it's not like on a screen where your user can scroll across, the paper comes to an end so you might as well stick to predefined controls and making superfluous ones invisible, as Duane and Crystal suggest.
> > >
> > > Yrs, Andrew
> > >
> > > --- In MS_Access_Professionals@yahoogroups.com, "nkpberk" <wgriffin48@> wrote:
> > > >
> > > > 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
> > > >
> > >
> >
>

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar