0
0 1
On frmABC, I click a command button to open any of several popup
forms. The relevant code that opens the forms is:
###
Dim blRet As Boolean
blRet = PositionFormRelativeToControl(stDocName, stLinkCriteria,
Me.cmdViewEvent, 4)
###
PositionFormRelativeToControl is a public function that opens up the
forms in a certain location using twips, API, and a lot of other stuff
I don't understand. I've tweaked it a little. The relevant code for
the function is:
###
Public Function PositionFormRelativeToControl(frmName As String,
stLinkCriteria As String, ctl As Access.Control, Optional Position As
Long = 0) As Boolean
....
DoCmd.openForm frmName, , , stLinkCriteria, OpenArgs:=Forms!
frmPatients!PatientID
###
Notice I've hard coded the OpenArgs reference to refer to PatientID on
frmPatients.
Now I want to use this same function, but with a different form for
which the PatientID reference won't work. The OpenArgs: value for this
second form needs to be:
OpenArgs:=Forms!frmSurgery!SurgID
How can I make the public function more generic by not hard coding the
OpenArgs values (and perhaps instead set it at the form level)?
Thank you.
forms. The relevant code that opens the forms is:
###
Dim blRet As Boolean
blRet = PositionFormRelativeToControl(stDocName, stLinkCriteria,
Me.cmdViewEvent, 4)
###
PositionFormRelativeToControl is a public function that opens up the
forms in a certain location using twips, API, and a lot of other stuff
I don't understand. I've tweaked it a little. The relevant code for
the function is:
###
Public Function PositionFormRelativeToControl(frmName As String,
stLinkCriteria As String, ctl As Access.Control, Optional Position As
Long = 0) As Boolean
....
DoCmd.openForm frmName, , , stLinkCriteria, OpenArgs:=Forms!
frmPatients!PatientID
###
Notice I've hard coded the OpenArgs reference to refer to PatientID on
frmPatients.
Now I want to use this same function, but with a different form for
which the PatientID reference won't work. The OpenArgs: value for this
second form needs to be:
OpenArgs:=Forms!frmSurgery!SurgID
How can I make the public function more generic by not hard coding the
OpenArgs values (and perhaps instead set it at the form level)?
Thank you.