Nancythomas
Registered User.
- Local time
- Today, 09:34
- Joined
- Apr 20, 2010
- Messages
- 59
I have designed a database with a main form and multiple subforms linked to the main form.
The main form is [Mainformstock_frml] and the [Subformstaff_frm]
The value gets passed from a popup form correctly but the problem is it directly open the subform [Subformstaff_frm] and passes the value.
I would like to pass the value from the popup form on to the form that is already opened.
Here is the script can you please advise what is incorrect and how can I get this to work.....
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Subformstaff_frm" ' This may be incorrect.........
stLinkCriteria = "[EmpNo]=" & Me![EMPNO]
DoCmd.OpenForm stDocName, , , stLinkCriteria, , , Me.EMPNO
Forms![Mainformstock_frml]![Subformstaff_frm]![EMPNO] = Me![EMPNO]
Forms![Mainformstock_frm]![Subformstaff_frm]![txtFirstName] = Me![Firstname]
Forms![Mainformstock_frm]![Subformstaff_frm]![txtSurname] = Me![Surname]
End Sub
Thanks
The main form is [Mainformstock_frml] and the [Subformstaff_frm]
The value gets passed from a popup form correctly but the problem is it directly open the subform [Subformstaff_frm] and passes the value.
I would like to pass the value from the popup form on to the form that is already opened.
Here is the script can you please advise what is incorrect and how can I get this to work.....
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Subformstaff_frm" ' This may be incorrect.........
stLinkCriteria = "[EmpNo]=" & Me![EMPNO]
DoCmd.OpenForm stDocName, , , stLinkCriteria, , , Me.EMPNO
Forms![Mainformstock_frml]![Subformstaff_frm]![EMPNO] = Me![EMPNO]
Forms![Mainformstock_frm]![Subformstaff_frm]![txtFirstName] = Me![Firstname]
Forms![Mainformstock_frm]![Subformstaff_frm]![txtSurname] = Me![Surname]
End Sub
Thanks