How to lose focus from a subform when selecting record

papasmurfuo9

Registered User.
Local time
Today, 14:10
Joined
May 28, 2014
Messages
69
Hi

i have a form, with a subform,

when a user selects a record from the subform i use this to view the record in the main form

Private Sub Txt_Support_Name_Click()
DoCmd.ApplyFilter , "ID =" & Me.ID
End Sub

however when i select the record from the subform, it populates the form as required, however then the top record of the subform is highlighted

anyway to either - highlight nothing, or highlight the selected row?

thanks
 
I assume, from what you're saying, that there are no linked fields from main form to subform? It looks like the subform is being requeried when you apply the filter. Try something like this

Before your DoCmd.ApplyFilter command:

Dim lngId as Long
lngId = Me.ID

after your DoCmd.ApplyFilter command:

Dim rstClone as DAO.Recordset
Set rstClone = Me.Form.RecordsetClone
rstClone.FindFirst "ID = " & lngId

Me.Bookmark = rstClone.BookMark
rstClone.Close
Set rstClone = Nothing

If it doesn't work in the click event, try putting it in the Form_Current event of the subform.
 

Users who are viewing this thread

Back
Top Bottom