Inactivate a subform

  • Thread starter Thread starter Faraz A. Qureshi
  • Start date Start date
F

Faraz A. Qureshi

I have the Parent Form with a field "CaseType" ComboBox with choice like
"Business";"Personal"

I want the subform to become inactive if "Personal" is chosen on the parent
form AND the SubForm's field "Partners" to acquire the same value as of
Parent Form's field "Name".

An Event Code/Macro/guidance shall highly be obliged?
 
I think this may work...

In the AfterUpdate event of the Partners control on the subform, run a check
to see if the Main Combo = Personal and the sub's Partner = the parent's Name
(I hope that's not actually the name of the field, being that Name is a
reserved word (and a function to change the filename/path of a file)). I
will abbreviate the controls with "ctl", fields with "fld"...


(aircode - untested - will need null handling added)
Private Sub ctlPartners_AfterUpdate
If (Me.Parent!ctlCaseType = "Personal") AND _
(Me.ctlPartners = Me.Parent!fldName) Then

'set the focus outside the subform and disable the subform's control
Me.Parent!SomeControl.SetFocus
Me.Parent!SubformControl.Enabled = False

End If
End Sub


hth


--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
Thanx again Jack!
XClent piece of code quite broadening the horizon of concepts!
 
Back
Top