I have a form with a subform.Both are in table mode.
In a parent form there is a filed named Firm (number of the firm)
In the Subform there is a field name ContactPerson.
I want the RowSource for the ContactPerson to be the data selected from the table CoWorkers,where Firm=Firm in a parent form
With some help I made it to work when the fild firm is changed.But How can I do it without changing the firm- when I just piy as rowsource the SLQ suery, it is done only for the first row, and then for all next firms uses that data
The code for firm change is
Private Sub cboFirm_AfterUpdate(Cancel As Integer)
Dim strRowSource As String
strRowSource = "SELECT [CoWorkers].[GenNumber], [CoWorkers].[Name ukr] & ' ' & [CoWorkers].[Surname ukr] AS surname, [Firms].[Number] FROM Firms INNER JOIN CoWorkers ON [Firms].[Number]=[CoWorkers].[Firm] WHERE [Firms].[Number]= " & Me.cboFirm
Me.subformContacts.Visible = True
Me.subformContacts!cboContactperson.RowSource = strRowSource
Me.subformContacts.Requery
End Sub
Please help me to adopt this code for each string
Thanks
Arseniy
In a parent form there is a filed named Firm (number of the firm)
In the Subform there is a field name ContactPerson.
I want the RowSource for the ContactPerson to be the data selected from the table CoWorkers,where Firm=Firm in a parent form
With some help I made it to work when the fild firm is changed.But How can I do it without changing the firm- when I just piy as rowsource the SLQ suery, it is done only for the first row, and then for all next firms uses that data
The code for firm change is
Private Sub cboFirm_AfterUpdate(Cancel As Integer)
Dim strRowSource As String
strRowSource = "SELECT [CoWorkers].[GenNumber], [CoWorkers].[Name ukr] & ' ' & [CoWorkers].[Surname ukr] AS surname, [Firms].[Number] FROM Firms INNER JOIN CoWorkers ON [Firms].[Number]=[CoWorkers].[Firm] WHERE [Firms].[Number]= " & Me.cboFirm
Me.subformContacts.Visible = True
Me.subformContacts!cboContactperson.RowSource = strRowSource
Me.subformContacts.Requery
End Sub
Please help me to adopt this code for each string
Thanks
Arseniy