
Originally Posted by
Micron
What's confusing - the property or how you'd implement it? Good enough if you're happy with your solution but multiple copies of objects are a thing to avoid when possible.
For your benefit (?) I see it as something as simple as this:
frm1 button click
DoCmd.OpenForm "frm3",,,,,Me.cbo1
or frm2 button click
DoCmd.OpenForm "frm3",,,,,Me.cbo2
Then in the Load event (not Open event) for frm3
Me.textboxNameHere = Me.OpenArgs
Thank you Micron!, it was confusing to me how to implement it, but with your example, now I get it perfectly, I was also going to ask you how to pass multiple values, but investigated first and managed to solve multiple values as well.
this is the final working code with multiple values being passed:
Code:
'Form1
Private Sub btnSchedule_Click()
Dim strWhere As String
strWhere = cmbStation & "|" & lstDesig
DoCmd.OpenForm "frmSchedule20", , , , , , strWhere
End Sub
'Form2
Private Sub btnSchedule_Click()
Dim strWhere As String
strWhere = lstStation & "|" & txtOperator
DoCmd.OpenForm "frmSchedule20", , , , , , strWhere
End Sub
'Frm3
Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRec
Dim intPos As Integer
Dim strOper As String
Dim strStat As String
If Len(Me.OpenArgs) > 0 Then
intPos = InStr(Me.OpenArgs, "|")
If intPos > 0 Then
strOper = Left$(Me.OpenArgs, intPos - 1)
strStat = Mid$(Me.OpenArgs, intPos + 1)
Me.txtOperator = strOper
Me.txtStation = strStat
End If
End If
Thanks for your help!
Regards!