Hey,
Could anyone please help me? I have a subform linked to a main form Master link is a text field on the main form while child link is a unique column on the subform. The RecordSource of the subform is a query. What I want to do is to populate other unbound textfields whenever I click on or select a record in the subform.
My query works well. I can get the first record to populate these fields but itt sits there and wouldn't move when I select the next record in the subform.
Below is the code I use in the "AfterUpdate" event of of the combo field (Master Link Field).
Private Sub cboFirmID_AfterUpdate()
txtFirmName = cboFirmID.Column(1)
strSQL = "Select * from Brand Where"
strSQL = strSQL & " FirmID=" & Me!cboFirmID.Text
Me!frmBrandSubform.Form.RecordSource = strSQL
'These are the main codes that populate the unbound textfields
txtBrandName = Me!frmBrandSubform.Form![BrandName]
txtBrandID = Me!frmBrandSubform.Form![BrandID]
txtFee = Me!frmBrandSubform.Form![Fee]
txtRegDate = Me!frmBrandSubform.Form![RegDate]
End Sub
Could anyone please help me? I have a subform linked to a main form Master link is a text field on the main form while child link is a unique column on the subform. The RecordSource of the subform is a query. What I want to do is to populate other unbound textfields whenever I click on or select a record in the subform.
My query works well. I can get the first record to populate these fields but itt sits there and wouldn't move when I select the next record in the subform.
Below is the code I use in the "AfterUpdate" event of of the combo field (Master Link Field).
Private Sub cboFirmID_AfterUpdate()
txtFirmName = cboFirmID.Column(1)
strSQL = "Select * from Brand Where"
strSQL = strSQL & " FirmID=" & Me!cboFirmID.Text
Me!frmBrandSubform.Form.RecordSource = strSQL
'These are the main codes that populate the unbound textfields
txtBrandName = Me!frmBrandSubform.Form![BrandName]
txtBrandID = Me!frmBrandSubform.Form![BrandID]
txtFee = Me!frmBrandSubform.Form![Fee]
txtRegDate = Me!frmBrandSubform.Form![RegDate]
End Sub