Subject: highlights entire record in subform as a list box

masoud_sedighy

Registered User.
Local time
Yesterday, 17:48
Joined
Dec 10, 2011
Messages
132
I would like continouse subform as a list box in my file. Now when click fields on my form the entire record will not be highlighted.
In the sample I have found from the net when click on each field in the form entire row will be highlighted. So I try to using function in the sample for my own but it does not work and when I click on each field just that field in 1 second will be highlighted and entire row will not be highlighted.

Private Sub P_ForceHighLight()​
On Error Resume Next​
Dim ct As Control, ct1 As Control​
[FONT=&quot][/FONT]​
DoCmd.Echo False​
Set ct1 = ActiveControl​
For Each ct In Me.Detail.Controls​
ct.SetFocus​
Next​
ct1.SetFocus​
DoCmd.Echo True​
[FONT=&quot][/FONT]​
ExitPoint:​
Set ct = Nothing​
Set ct1 = Nothing​
[FONT=&quot][/FONT]​
' Note - This work-around is found necessary​
' in continuous form, for ensuring that​
' conditional highlight takes effect promptly.​
' (No such problem for datasheet form)​
On Error GoTo 0​
End Sub​
----------------------------------------------------
Private Sub Item_Name_Click()​
P_Click​
End Sub​
[FONT=&quot] [/FONT]​
Private Sub Item_Number_Click()​
P_Click​
End Sub​
----------------------------------------------------------------​
Private Sub P_Click()​
On Error Resume Next​
Dim ct As Control​
Dim Pos As Long​
[FONT=&quot][/FONT]​
Pos = Me.Recordset.AbsolutePosition​
Set ct = ActiveControl​
[FONT=&quot][/FONT]​
' Clear other selections​
P_ClearSelections​
Me.Recordset.AbsolutePosition = Pos​
[FONT=&quot][/FONT]​
Me.IsSelected = True​
ct.SetFocus​
[FONT=&quot][/FONT]​
' Save the status​
Me.Dirty = False​
' Force conditional highlighting​
P_ForceHighLight​
[FONT=&quot][/FONT]​
' Update display of SF_Selected​
Me.Parent("SF_Selected").Requery​
[FONT=&quot][/FONT]​
ActiveControl.SelLength = 0​
[FONT=&quot][/FONT]​
Set ct = Nothing​
On Error GoTo 0​
End Sub​
 
have you considered just using the in-built record selector from property, clicking on this will highlight the entire row

David
 

Users who are viewing this thread

Back
Top Bottom