Data definition

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Data definition

Post by Pat »

I have a the following Dim statement:
Private jobReview(10) As [Form_Service Manager - Job Info]
where Service Manager - Job Info is the name of the form that the code is in.
I notice further down in the code the following is done:

Code: Select all

        Set jobReview(lastJobReview) = New [Form_Service Manager - Job Info]
        jobReview(lastJobReview).Tag = "Instance"
        jobReview(lastJobReview).filter = "[ServiceID] = " & currentID
        jobReview(lastJobReview).FilterOn = True
        jobReview(lastJobReview).Visible = True

        lastJobReview = lastJobReview + 1
[\code]
Does the dim statement setup an array of form attributes that the code saves to?

User avatar
HansV
Administrator
Posts: 78609
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Data definition

Post by HansV »

The declaration statement creates an array of 11 objects (indexed 0 ... 11) of the type of the form. These objects are initially empty.

The line

Set jobReview(lastJobReview) = New [Form_Service Manager - Job Info]

creates a new form as a clone of Service Manager - Job Info, and assigns it to one of the array elements. This way, you can have multiple copies (clones) of a form open at the same time, something you cannot do with DoCmd.OpenForm.
Best wishes,
Hans

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Re: Data definition

Post by Pat »

Thanks i'll go back and study what that code does and where else it is used.

User avatar
HansV
Administrator
Posts: 78609
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Data definition

Post by HansV »

See ACC2000: How to Open Multiple Instances of a Form, and for a simple example of this technique, see the free Access 2000 Sample: Database of Sample Forms.
Best wishes,
Hans

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Re: Data definition

Post by Pat »

Thanks Hans, that is nifty