Win XP with A2003
I have a form called ProjectEdit. ProjectEdit shows a single record from a table called Project, with the key field being PRID. When I click an Edit button, I want to open another form, called ProjectDetailEdit, showing only detail records related to the record on ProjectEdit. My detail records on ProjectDetailEdit have many fields, the fields will not fit on a subform.
From ProjectEdit, when I open the ProjectDetailEdit, how do I set a text box on ProjectDetailEdit, called txtProjectID to contain the PRID from ProjectEdit?
Also, I would like the combo box (a search box) to show only records where PRID = the PRID from ProjectEdit, so I have to set the Rowsource for cbxSearch.
My question is, is this valid code, and the best way to do it?
I have a form called ProjectEdit. ProjectEdit shows a single record from a table called Project, with the key field being PRID. When I click an Edit button, I want to open another form, called ProjectDetailEdit, showing only detail records related to the record on ProjectEdit. My detail records on ProjectDetailEdit have many fields, the fields will not fit on a subform.
From ProjectEdit, when I open the ProjectDetailEdit, how do I set a text box on ProjectDetailEdit, called txtProjectID to contain the PRID from ProjectEdit?
Also, I would like the combo box (a search box) to show only records where PRID = the PRID from ProjectEdit, so I have to set the Rowsource for cbxSearch.
My question is, is this valid code, and the best way to do it?
PHP:
Private Sub cmdEditDetails_Click()
Dim s As String
' WHERE clause for form's filter.
s = "[PRID]=" & txtID
DoCmd.OpenForm "ProjectDetailEdit", acNormal, , s ' s sets form's filter.
Forms("ProjectDetailEdit").txtPRID = txtID
End Sub