Change form properties on an adjacent form

  • Thread starter Thread starter voigtem
  • Start date Start date
V

voigtem

I have a main form with several subforms in it. Data gets "moved" from
one subform to another and I got the requery process down pat for that.
However, I also want to be able to update the form properties
(background color) of the destination subform to reflect the data move
as well. Any ideas? I already know how to change the source subform's
properties in VBS.
 
I'm not quite clear on whether your code is running behind the main form, or
behind one of the subforms. Here are examples of each ...

From the main form ...

Private Sub Command0_Click()

Dim frm As Form

Set frm = Me.sfrOne.Form
With frm
If .Section("Detail").BackColor = vbRed Then
.Section("Detail").BackColor = vbBlue
Else
.Section("Detail").BackColor = vbRed
End If
End With

End Sub

From one of the subforms ...

Private Sub Command1_Click()

Dim frm As Form

Set frm = Me.Parent.Controls("sfrTwo").Form
With frm
If .Section("Detail").BackColor = vbRed Then
.Section("Detail").BackColor = vbBlue
Else
.Section("Detail").BackColor = vbRed
End If
End With

End Sub
 
I'm running the code from the source subform. me.parent... eh? I'll
have to try that. Will this also allow me to reference specific
records in the destination sub from from the source subform?
 
I want to change the detail backgroud color of the specific record that
moved from the source subform to the destination subform. This is to
highlight which record moved (subforms are in the continuous forms
view).
 
I am not aware of any method that will change the detail background colour
for a single record in a continuous form, without changing the detail
background colour for all records.

You can use the conditional formatting feature to change the formatting of
text boxes, etc., on a record-by-record basis, to achieve almost the same
result. But (as far as I know) there would have to be some value stored in
the record to trigger the conditional formatting. For example, if you update
a date/time field in the record, you could probably use conditional
formatting to highlight it using an expression that compared that date/time
field with the current system time.

Here's a link to the on-line help topic on conditional formatting ...

http://office.microsoft.com/assistance/hfws.aspx?AssetID=HP052610911033
 
Well Thanks anyway - at least I know not to bang my head against that
brick wall. Condifional formatting based on another field - That could
work - I could make a "just moved" and set the condition based on that.
Thanks!!!
 
Back
Top