Inactivate a subform

  • Thread starter Faraz A. Qureshi
  • 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?
 
J

Jack Leach

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)
 
F

Faraz A. Qureshi

Thanx again Jack!
XClent piece of code quite broadening the horizon of concepts!
 

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

Top