i guess is should have more specific. the control i want to reference is created at run time. the code is below

PHP Code:
Function GetTop(ByRef GetPageNameByRef GetQName)

        
On Error GoTo errorhandler

        Dim NewTop
        Dim QTop

        QTop 
Form1.TabControl1.TabPages(GetPageName).controls(GetQName).top

'where GetPageName is the name of the page the control is on
'
and GetQName is the name of the control i want to reference

        MsgBox
(QTop)    

        Return 
QTop

errorhandler
:
        If 
Err.Number 0 Then
        
Else
            
MsgBox(Err.Description)
        
End If

    
End Function 


if get the error: Object variable or with block variable not set