Searching Subform and refreshing main

dynamictiger

Registered User.
Local time
Today, 07:12
Joined
Feb 3, 2002
Messages
270
This is difficult to explain, so if it appears a little vague I apologise in advance.

I have a main form set up that record names and contact details, this contains a subform which includes the address and details of the dwelling. As owners change we have seperated the dwelling from the owner.

In the header of the main form we have set up two combo boxes, the first searches by name the entire recordset, the second searches the subform by address. This enables two searches including one for non resident landlords. So far so good.

I then thought it would be nice to be able to search the master form by address, and realised this means the subform would become the master at that point. I am not sure how to go about this.

I think I would have to search the address record for the clientID, then requery the master form. Anyone got any ideas?
 
Problem solvered.

Private Sub Combo14_AfterUpdate()

' Find the record that matches the control.
Dim rs As Object
Dim strSearch As String

strSearch = Nz(Me.Combo14.Column(3), 0)

Set rs = Me.Recordset.Clone
rs.FindFirst "[ClientID] = " & strSearch
If Not rs.EOF Then Me.Bookmark = rs.Bookmark


End Sub

In the current event of the subform we also run a current event

Private Sub Form_Current()

' Find the record that matches the control.
Dim rs As Object


Set rs = Me.Recordset.Clone

rs.FindFirst "[ID] = " & Str(Nz(Form_tblClient.Combo14.Column(0), 0))

If Not rs.EOF Then Me.Bookmark = rs.Bookmark

End Sub

If the record is one owner with multiple places this finds the appropriate record.
 

Users who are viewing this thread

Back
Top Bottom