Change BackColor on subf when main form field is changed

  • Thread starter Thread starter Kirstie Adam
  • Start date Start date
K

Kirstie Adam

All,

How do i change the backcolor of my field [Search Area Issued] which is on
subform [Acq Subf], when i change the field [Work Type] on the main form
[Main Form]?

Any suggestions greatly appreciated,

Kirstie
 
Kirstie,

Use the After Update event for the Work Type field (and probably the Current
event for the form itself). The code would be something like:

Private Sub Work_Type_AfterUpdate()

' Check the Value of the work type
If Me![Work Type] Like "Some Value" Then
' Change the subform fields back colour to be red
Me![SubFormControlName]![Search Area Issued].BackColor = vbRed
Else
' Change the subform fields back colour to white
Me![SubFormControlName]![Search Area Issued].BackColor = vbWhite
End If

End Sub

Note that the SubFormControlName is probably [Acq Subf]. The name that you
need to replace here is the subform control name on the main form. This also
assumes that the sub form is not a Continuous Subform. You would need to use
Conditional Formatting to accomplish this with a Continuous form.

HTH,

Neil.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top