Allen Browne's MultiForms

A

aceavl

hi!
hope you can help me!
i'm trying to change Allen Browne's code to open multiple reports.
the problem i have is that the name of the report may not always be the same
the line:

Set rpt = New Report_rptTempNom

can i make this line accept avariable? rptTempNom is a public variable but it
gives me an error
"User-Defined Type Not Defined"

what can i do?

thanks.


'Adapted from: http://allenbrowne.com
Public clnClient As New Collection 'Instances of frmClient.
Function OpenAClient()
'Purpose: Open an independent instance of form frmClient.
Dim rpt As Report
'Open a new instance, show it, and set a caption.
Set rpt = New Report_rptTempNom <----
----
rpt.Visible = True
rpt.Caption = rpt.Hwnd & ", opened " & Now()
'Append it to our collection.
clnClient.Add Item:=rpt, Key:=CStr(rpt.Hwnd)
Set rpt = Nothing
End Function
 
A

Allen Browne

I am not aware of a way to use a variable for the name of the class to open,
other than passing the name is as a string and then using a huge Select Case
construct to make the name to the appropriate class.

If anyone else has an approach that works, that would be great.
 
A

aceavl via AccessMonster.com

thank you for answering Allen, i'll try to do it another way.

Allen said:
I am not aware of a way to use a variable for the name of the class to open,
other than passing the name is as a string and then using a huge Select Case
construct to make the name to the appropriate class.

If anyone else has an approach that works, that would be great.
hi!
hope you can help me!
[quoted text clipped - 29 lines]
Set rpt = Nothing
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top