Solved

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

Posted on 2007-11-29
4
403 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

726 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