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

Changing back colour after data change

Status
Not open for further replies.

techkenny1

Technical User
Jan 23, 2009
182
AU
Hi,

On a form I have a combobox with data.
What I want to do is that' when the data in a 'field' is changed via the combobox, the back colour changes on that 'field' so that the changes are visible. The code I use for this is as follows;

On the after update of the combobox

Dim rs As ADODB.Recordset
Dim strSQL As String

cboCompanyname.SetFocus
If cboCompanyname.Value > 0 Then
strSQL = "SELECT * FROM QBroker WHERE Brokerstaffid = " & cboCompanyname.Value

Set rs = CreateObject("ADODB.Recordset")
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
rs.Open strSQL, CurrentProject.Connection

If rs.State = 1 Then
If Not rs.BOF Then

Me.BrokerStaffID = rs("BrokerstaffID")
Me.Companyname = rs("Companyname")
Me.BDr = rs("BDR")
Me.BNR = rs("BNR")
Me.BSatR = rs("BSATR")
Me.BSunR = rs("BSUNR")
Me.BPwknR = rs("BPWKNR")
Me.BPHR = rs("BPHR")
Me.BPWndR = rs("BPWNDR")
Me.BSpec = rs("BSPEC")


End If
rs.Close
End If
Set rs = Nothing



Many thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top