473,654 Members | 3,071 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AllowAdditions In Subform

Tom
I have a button on a main form that executes code to write to the subform.
The subform's AllowAdditions property is set to false and in the button's
code the subform's AllowAdditions property is set to True before the code to
write to the subform. The code to set AllowAdditions to True is:
Me!NameOfSubfor mControl.Form.A llowAdditions = True
When I click the button, I get the error message, Error 2448 You can't
assign a value to this object. If I go to the subform's properties and set
AllowAdditions to True and then click the button om the main form, the code
writes to the subform as desired. Is there something special that has to be
done to programatically set a subform's AllowAdditions to True from a main
form?

Thanks,

Tom
Nov 13 '05 #1
6 3792
jv
The syntax to allow additions seems to be ok. Have you set debugging
break point to see where you are you getting the error on the
allowadditions line or on the code to write the new record?

I usually add new records to a subform by using DoCmd.RunSQL "INSERT
INTO ..." then do a me.refresh on the main form.

Nov 13 '05 #2
ABG
Or, another way if you like your current method is to make a copy of
the subform, and have the button first switch the subform out.

me.thesubform.s ourceobject = "theNameOfTheOt herSubform"
then have your code do it's writing for you and then set the source
object back.

JV's suggestion is the more elequent method, though

Nov 13 '05 #3
ABG wrote:
Or, another way if you like your current method is to make a copy of
the subform, and have the button first switch the subform out.

me.thesubform.s ourceobject = "theNameOfTheOt herSubform"
then have your code do it's writing for you and then set the source
object back.

JV's suggestion is the more elequent method, though


JV's suggestion is an interesting idea. I have used the subform switch
out in the past because if the subform is editable I couldn't always
edit another 'dynaset'. Does the "INSERT INTO ..." SQL work when the
subform is editable?

Thanks in advance,

James A. Fortune

Nov 13 '05 #4

DoCmd.RunSQL "INSERT INTO..." works independent of the form or subforms
because it inserts it directly into the table, not the form. That is
reason why you need to requery afterward so that the new record would
show up on the form.
Julie

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #5
julie vazquez wrote:
DoCmd.RunSQL "INSERT INTO..." works independent of the form or subforms because it inserts it directly into the table, not the form. That is
reason why you need to requery afterward so that the new record would
show up on the form.
Julie

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


I apologize for being unclear. Let me rephrase the question. If the
editable subform is bound to a table through its RecordSource, will
Access allow the INSERT to the same table to occur at all? With A97 I
have gotten error messages when using an update query under those
conditions. I should stop being lazy and just try it.
James A. Fortune

Nov 13 '05 #6
Update should work as long as the record is not being locked for
whatever reason. Insert should always work regardless.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
24819
by: Rey | last post by:
Howdy all. Appreciate your help with several problems I'm having: I'm trying to determine if the Visit subform (subformVisits) has a new record or been changed, i.e. dirty. The form that contains the subform is named Clients. I have this code in the Add Client btn: If Forms!Clients.subformVisits!VisitDirty = True Then MsgBox "Visit subform is dirty!"
3
13834
by: Randy Harris | last post by:
I've been fighting with this for hours and can't figure it out. I have a continuous subform which I don't want the NewRecord line to appear by default. I have a button on the main form, my desire is to have it change to allow additions, set focus to the subform and then GotoRecord,, acNewRec. I can't get the syntax right for the AllowAddtions. Sub Button_Click() ' Various failed attempts: Me!MySubform.AllowAdditions = True
5
1680
by: Trev | last post by:
If I set AllowAdditions to false in A2K2, I can still add records in the form, I expected to get a blank form if on a new record :-\
25
10219
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab Control in the form, and in one of the tabs I have a subform (sfmSiblings) in which I wish to list...
1
8474
by: John Michael | last post by:
I have a form that has a subform that has a subform. The subform loads a record based on a combo lookup box in the main form. I'm trying to set a value in the subform based on a value in a subform of the subform. the main Form is called Subform is called Subform in the subform is called
4
7002
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the user enters the last qualifying field on the main form. In one case this works fine, the subform shows the data the user wants to update -- which means showing all the data put in previously (ie showing this via the requery and the continuous...
1
3037
by: MP | last post by:
I have a main form that has a subform which also has a subform: the main form is the first subform is the second subform is When I click on the button »AddNewSubSubRecord« (add a new record in the second subform , the code generates the message: Can't find the field »POG-03 Work Subform« reffrred to in your expression.
6
5965
by: DMUM via AccessMonster.com | last post by:
Hello I am trying to pass the name of my subform to a function/sub but I can't seem to get it to work. I am using an autokey function (ctrl E) to unlock text boxes on a subform. I have a few forms in the database that will use this function, so I need to be able to tell the code which form to unlock. What I have is as follows: Public Function akeyEdit()
4
8825
by: Macbane | last post by:
Hi, I have a 'main' form called frmIssues which has a subform control (named linkIssuesDrug) containing the subform sfrmLink_Issues_Drugs. A control button on the main form opens a pop-up form which allows me to edit the record in the subform. What I want to happen is for subform with the new edits to be updated on the main form when I close the popup. I'm sure this is a very small bit of code in the the 'On close' event for the popup...
0
8379
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8294
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8709
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8494
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1597
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.