Solved

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

Posted on 2007-11-29
4
394 Views
Last Modified: 2013-11-28
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.
0
Comment
Question by:AbacusInfoTech
  • 2
  • 2
4 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 20377704
Use VBA in myCombo's After update event:

Private Sub MyCombo_AfterUpdate()
       If me.MyCombo = "Ordered" THEN Me.frmSubform.form.AllowAdditions = False
       If me.MyCombo = "Not Ordered" THEN Me.frmSubform.form.AllowAdditions = True
End sub

You also need to place this in the form's current event so that the subform will have the property set correctly  as the user scrolls through records.
0
 
LVL 1

Author Comment

by:AbacusInfoTech
ID: 20378035
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
0
 
LVL 61

Expert Comment

by:mbizup
ID: 20378067
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?
0
 
LVL 1

Author Comment

by:AbacusInfoTech
ID: 20378413
I am using 2000... and I tried without .value so I guess 2003 may be different.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now