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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Background color of current record?

Status
Not open for further replies.

gtroiano

Technical User
Nov 7, 2001
99
US
i have a continuous sub form with three fields per record based on a table and i would like to have the background color of the entire record change of the when it's is selected. i set the background color of each of the controls to the highlight color and then set the back style to transparent but that will only "highlight" the active control. i also tried the example from and it works but on the main form that the sub form is on i have a text box and a "Find Next" button used to search the table. for reasons that are beyond my knowledge, when i use the example from the afformentioned link the search function only goes to the first matching record and then the "Find Next" button doesn't return any more matching records. if someone has an alternative way of hightlighting the whole record, i would appreciate it greatly.

this is the code behind the search text box:
[red]Private Sub txtFind_AfterUpdate()
On Error GoTo Err_txtFind_AfterUpdate

Dim stResponse As String

stResponse = txtFind
If stResponse = "" Then
GoTo Exit_txtFind_AfterUpdate
Else

If Me.optSearch = 1 Then stFindCriteria = "[AccountTitle] Like '*" Else
If Me.optSearch = 2 Then stFindCriteria = "[AccountNumber] Like '*" Else
If Me.optSearch = 3 Then stFindCriteria = "[FamsNumber] Like '*" Else
stFindCriteria = stFindCriteria & stResponse & "*'"
End If

Me.fsubMaintainAccounts.Form.RecordsetClone.FindFirst stFindCriteria
If Me.fsubMaintainAccounts.Form.RecordsetClone.NoMatch Then
MsgBox "Search text was not found."
stFindCriteria = ""
Else
Me.fsubMaintainAccounts.SetFocus
Me.fsubMaintainAccounts.Form.Bookmark = Me.fsubMaintainAccounts.Form.RecordsetClone.Bookmark
End If

Exit_txtFind_AfterUpdate:
Exit Sub

Err_txtFind_AfterUpdate:
Resume Exit_txtFind_AfterUpdate
End Sub[/color]

this is the code behind the "Find Next" button:
[red]Private Sub cmdFindNext_Click()
On Error GoTo Err_cmdFindNext_Click

If stFindCriteria = "" Then
GoTo Exit_cmdFindNext_Click
Else
Me.fsubMaintainAccounts.Form.RecordsetClone.FindNext stFindCriteria
If Me.fsubMaintainAccounts.Form.RecordsetClone.NoMatch Then
MsgBox "Search text was not found."
stFindCriteria = ""
Else
Me.fsubMaintainAccounts.SetFocus
Me.fsubMaintainAccounts.Form.Bookmark = Me.fsubMaintainAccounts.Form.RecordsetClone.Bookmark
End If
End If

Exit_cmdFindNext_Click:
Exit Sub
Err_cmdFindNext_Click:
Resume Exit_cmdFindNext_Click
End Sub[/color]

i can post the code for the highlighting example from if it helps but if you are familiar with it, all the better. thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top