Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Renewing data in a table Subform-Help needed

Status
Not open for further replies.

finberg

Programmer
Aug 23, 2002
27
UA
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top