In VB6, I have a main form (frmMain) with three subsidary forms. The latter set various properties on frmMain, e.g. frmMain.NoCopies = x

I have a number of procedures that I want to put this in, so I need to pass the name of the form as a variable - otherwise I will end up with three subsidiary forms for each procedure.

Is it possible?

(I am trying to pass the info as public variables, but it seems to be a long way round)


Did you try passing


Hi Hussain,

My problem is not in passing the name but in using the variable in the subsidiary form - e.g. instead of using the code frmMain.NoCopies = 2
I want to be able to use (varaible).NoCopies = 2


Try something like this:

Dim frm As Form

'frm = some form reference....
frm = frmMain

frm.NoCopies = 2

Dim a As Form
Set a = Forms(1)
MsgBox a.NoofCopies

'I hope it will help.
'Note: make sure the form is loaded

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.