Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Dynamically creating controls on a form


Message #1 by "Simon Garstin" <sgarstin@t...> on Fri, 16 Mar 2001 17:55:34 -0000
 Can anyone help me with this.

 I am creatng an Access form to display the parts required to complete a job

 depending on which job is selected in a combo box.

 However the number of parts needed to do the job will vary and I would like

 the form to expand or shrink accordingly when the parts are displayed,

which

 is preferred to simply specifying a maximum likely number so I get them

all,

 and then have huge gaps in the form for those jobs which don't need many

 parts.



 One method that works is to display the parts in a table and set the height

 of the table to equate to the number of parts each time a new job is

clicked

 on - great but there are limited ways to display a table, and I need the

 data to be displayed (for printing out) in a particular format. Thus I

would

 prefer to display the part details in a list of Access labels, which offers

 greater flexibility in style/format (this is not overkill as there are only

 2 columns to display).



 So I need to dynamically create and then display the appropriate number of

 labels - on the fly as each job is selected. Setting the properties of the

 labels after that by VBScript is straightforward - but how to create them

???



 The CreateControl method only works in design view - so that is out.



Alternatively, is it possible to create ARRAYS of controls on the fly ?



 Can anyone help ?





 regds





 Simon G









Message #2 by Brian Skelton <brian_skelton@o...> on Sun, 18 Mar 2001 21:54:36 GMT
Simon



Could you use a multi-part subform? You would have to move 

your parts details into a seperate table from the job 

details, but this might be a good move anyway, especially if 

parts can be involved in more than one job.



You would then place your job details in one form, and then 

create a subform with the part details on it. If you set the 

subform's Default View to 'Continuous Form' and Dividing 

Lines to 'No', you would have an infintely 

extendable\shrinkable list.



BDS



-----Original Message-----

From:	Simon Garstin [SMTP:sgarstin@t...]

Sent:	16 March 2001 17:56

To:	Access

Subject:	[access] Dynamically creating controls on a 

form



 Can anyone help me with this.

 I am creatng an Access form to display the parts required to 

complete a job

 depending on which job is selected in a combo box.

 However the number of parts needed to do the job will vary 

and I would like

 the form to expand or shrink accordingly when the parts are 

displayed,

which

 is preferred to simply specifying a maximum likely number so 

I get them

all,

 and then have huge gaps in the form for those jobs which 

don't need many

 parts.



 One method that works is to display the parts in a table and 

set the height

 of the table to equate to the number of parts each time a 

new job is

clicked

 on - great but there are limited ways to display a table, 

and I need the

 data to be displayed (for printing out) in a particular 

format. Thus I

would

 prefer to display the part details in a list of Access 

labels, which offers

 greater flexibility in style/format (this is not overkill as 

there are only

 2 columns to display).



 So I need to dynamically create and then display the 

appropriate number of

 labels - on the fly as each job is selected. Setting the 

properties of the

 labels after that by VBScript is straightforward - but how 

to create them

???



 The CreateControl method only works in design view - so that 

is out.



Alternatively, is it possible to create ARRAYS of controls on 

the fly ?



 Can anyone help ?





 regds





 Simon G


  Return to Index