Allen,
Intriguing remark previously unknown to me. Thanks.
So, now I want to create a routine, ActiveFormClone, that will create a
'clone' of the current form (instance) over the same recordset, but am
having a problem 'cloning' the form. I've researched a bit and come up dry.
Any ideas for me?
Code follows sig!
Cheers,
Malcolm Cook - (e-mail address removed)
Database Applications Manager - Bioinformatics
Stowers Institute for Medical Research - Kansas City, MO USA
#If False Then 'used in failed attempt below
Public gAccessFormClone As Access.Form
#End If
Public Function ActiveFormShowClone() As Access.Form
ActiveFormShowClone = AccessFormClone(Screen.ActiveForm)
With ActiveFormShowClone
.Visible = True
End With
End Function
Public Function AccessFormClone(frm2Clone As Access.Form) As Access.Form
'purpose: open a 'clone' of a form, over the
'same underlying recordset as frm2Clone.
'author: Malcolm_Cook@stowers_institute.org
'Motivated by comment:
' In Access 2000 and later you can set the Recordset of one form to that
of
' another, so they always display the same set of records.
'BUT! I can't find way to dynamically create new form of variant type.
Drat.
' It can't be done, in A2K+, per:
'
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=75fjoukrssd11u7g178
s7s11egmfbkoet1%404ax.com
'Anyway, my failed attempts follow, allong with hardcoded 'solution'.
#If False Then
Set AccessFormClone = New frm2Clone 'Compile Error: User Defined Type
not defined
#ElseIf False Then
Set AccessFormClone = Eval("New " & frm2Clone.name) 'err: can not find
the name 'Set' you enetered in the expression
#ElseIf False Then 'A
Eval "Set gAccessFormClone = New Form_" & frm2Clone.name 'err: can not
find the name 'Set' you enetered in the expression
Set AccessFormClone = gAccessFormClone
Set gAccessFormClone = Nothing
#Else
Select Case frm2Clone.name
Case "request"
Set AccessFormClone = New Form_request
Case "plate"
Set AccessFormClone = New Form_plate
Case Else
Stop
End Select
#End If
With AccessFormClone
Set .Recordset = frm2Clone.Recordset
End With
End Function