Link to home
Start Free TrialLog in
Avatar of AbacusInfoTech
AbacusInfoTech

asked on

Set a subforms allowadditions property based on a value in a form

I want to set the allowadditions property of [frmSubForm] to FALSE if a value of a combo [mycombo] in the parent form [frmMain] is "Ordered"

If the user changes this combo (to "Not Ordered") then the allowadditions property gets re set to TRUE.

If the user changes the combo (back to "Ordered") then the allowadditions property gets re set to FALSE.
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AbacusInfoTech
AbacusInfoTech

ASKER

Thanks, you got me there.

Just had to tweak:

Private Sub MyCombo_AfterUpdate()
       If me.MyCombo.Value = "Ordered" THEN Me.frmSubform.form.AllowAdditions = False
       If me.MyCombo.Value = "Not Ordered" THEN Me.frmSubform.form.AllowAdditions = True
End sub
Glad to help out :-)
I'm suprised you needed the ".Value".  I use the exact syntax I posted routinely.  I use access 2003 where ".value" is the default property.  Your question tags state Access 2000.  I wonder if that accounts for the difference?
I am using 2000... and I tried without .value so I guess 2003 may be different.