?
Solved

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

Posted on 2007-11-29
4
Medium Priority
?
410 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
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 …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

752 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