473,771 Members | 2,365 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to loop through subform records, update the 2nd row in a subform

1 New Member
Hi. I have a Main form with a Subform. My Main form generates an ID and some info is passed to the subform alongwith the ID. Lets say some changes are made to the mainform, this info is then added to the subform as a new record with the same ID (as in the main form) i.e saved as a 2nd record in my subform and will show under the main forms ID as 2 records. There are times when I have to generate the same values of the main form and capture the data as a new record in the mainform. I am able to do this for the main form, but I can only update the first record withtin the subform. inspite of using loops, movenext etc etc, I am unable to move to the next record to update it with the Main form ID. How do I copy the data in the subform and add it as a new record in the subform with the new ID generated in my Main form. Am i doing sumthing wrong in the loop? I need the solution ASAP and hence have posted this problem here for the first time as I cannot figure this bit of code...I would say I am an intermediate Access user with fair bit of access knowledge..

btw, pls also note that after the 1st record is updated, I get a write conflict as well...

Any help to resolve these 2 issues (which I believe are interlinked) would be appreciated.
Aug 18 '10 #1
2 3077
Jerry Maiapu
259 Contributor
I do not really understand what you are trying to say.
You did not post any code, though you mention that you did tried something.
You are trying to:
1. Copy some info from parent form into a new record in subform?
2. Change/Edit values for all records in datasheet/subform from Main Form?

Can you make your question more clearer.?

You maight have a look at this thread Inserting values into subform datasheet from main form.. It's similar to what your are trying to say.
I found the solution myself
Sep 5 '10 #2
NeoPa
32,573 Recognized Expert Moderator MVP
I'm not clear what you're trying to achieve Gavin, but I would say that any design where a subform is bound to the same data as the main form is not recommended and is very likely to leave you facing such data contention issues. Fundamentally and logically it is an illogical setup.

I would give consideration to exactly what you are hoping to achieve here and try to come up with a more appropriate design for it.
Sep 7 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
7193
by: Maggieanp22 | last post by:
I'm designing a db which stores client details but each client has multiple 'occasions'. For each occasion there is a section which has items purchased (there are sometimes none, sometimes several). But the main difficulity I'm having is when I try to do stock control stuff to keep track of how many of each individual item has been sold. The basis I've got so far is a client table an occasion table, which is linked to the client ID,...
0
1144
by: Paul T. Rong | last post by:
In form ¡°Order¡± there are 4 important controls: - combo1 (unbounded, source from ProductID field of Product table), - txt1 (I wish the product name will automatic show here after the user inputs the product number in combo1), - txt2 (where the user inputs the quantity of the Product needed, then press ¡°Enter¡± key, then triggers a Docmd.RunSQL ¡°insert into¡­ code to add records to the subform ¡°Order_detail¡±) - a subform...
1
3433
by: Terri | last post by:
I'm summing subform records in a control on a main form. I have a control in the subform footer called TotalAmount with the control source =Sum(). On my mainform control I reference this control =.!. Works great except when the subform has no records. I get "#error" when I'd like to get 0. I've tried =NZ(.!,0).
6
3167
by: ryan | last post by:
I created in design view a subform within a subform. However the subform within the subform in only visible in design view. In form view the subform within the subform is not visible. I have only nested from the mainform to a subform into another subform. Any clues why my subform within my subform is not visible in form view?
4
3133
by: tlyczko | last post by:
I have been looking on the NGs and I found this code to show if a subform has no records. I have this code in the MAIN form OnClose event: Private Sub btnClose_Click() '4/16/06 new code that cancels the close event if the BeforeUpdate code fires '4/16/06 see...
1
3807
by: jmarr02s | last post by:
Is it possible to limit the number of Subform records using MS Access 2003? That is, my end users want the capability of entering up to 12 records on their subform. Is that possible? Thanks!,
4
8850
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...
3
5388
by: paquer | last post by:
On my Main form I have a Command Button that opens a Subform in order to create a new Subform record. At this point I want the subform to show only the new record being created. Not all the records the subform's table has. I cannot put the subform as Data Entry because I cannot print the main form & subform together if the subform is "data entry". (comes up blank every time)
4
1448
by: NJonge01 | last post by:
I posted a similar problem weeks ago, and I received some great advice but none of which I was able to apply successfully. I suspect that part of the problem was I had already begun the work myself, and probably corrupted the scenario. I worked thru that situation with multiple forms. I am about to start on a new project. Before I even begin, I welcome ANY advice. I manage software design documents following an implementation of the RUP...
0
1846
by: jwbird | last post by:
I have a main form with multiple Subforms that are all displaying Datasheet information related to the Main form record. When I make changes/adds to the records(s) in the subform and tab to another subform, it saves those previous subform records fine, but when I make changes to the subform records and then change the mainform criteria, it doesn't save those subform records. I can use an event to prompt for saving the records on the...
0
9619
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
10261
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
10103
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
10038
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,...
0
9911
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7460
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
5354
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...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2850
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.