473,624 Members | 2,238 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Recordset Update from one table to another using main form/Subform

2 New Member
I am trying to update the main form with each record in the subform.
I have two tables Invoice and Payment table.
The main form has the payment details which I need to update for each invoice selectedon the subform.
EG
Invoice Table (SubForm)
Ref no , Inv No , Amt
1 , 101 , 10.00
2 , 102 , 20.00 etc

Payment Table Feilds (Main Form)
RefNo , Inv No , chq no amt

The code should update as follows
Payment Table Should be
RefNo , Inv No , chq no, amt
1 , 101 , 111 , 10.00
2 , 102 , 111 , 20.00

the code updates the Invoice table fine but only updates the last record in the payment table. What I need is a additional loop which adds to the payment table.

Payment Table Results
RefNo , Inv No , chq no, amt
2 , 102 , 111 , 20.00

Thanks for any help.


code
Private Sub cmdUpdatePaymen ts_Click()
Dim DB As DAO.Database
Dim rs As DAO.recordset
Dim rs1 As DAO.recordset

Set DB = CurrentDb
Set rs = DB.OpenRecordse t("PBPurchases" , dbOpenDynaset)
Set rs1 = DB.OpenRecordse t("PBPayAmt", dbOpenDynaset)
rs.MoveFirst
'-----------------------------------------------------------
Do Until rs.EOF

If Me!txtYesNo = -1 Then
Me!PBSelectPay = -1
Me!PBSelPayDes = "Paid"
Me!Recon = "R"
Requery
Else
If Me!txtYesNo = 0 Then
Me!PBSelPayDes = "Un Paid"
Me!PBSelectPay = 0
End If
End If

rs.MoveNext
Loop
End Sub
Mar 1 '11 #1
0 1489

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

Similar topics

9
3325
by: William Wisnieski | last post by:
Hello Everyone, Access 2000 I have a main form with a continuous subform. On the main form I have a text field called . It gets populated based on what the user selects in a field on the sub form (code in the AfterUpdate Event). Here's the issue. If the user deletes a subform record. The field on the main form shows null even if there is a value in the preceding subform record. What I'd like it to do is immediately refresh to
1
2192
by: Bill Strass | last post by:
Problem: Access main form/subform as front end to SQL Server backend. Add/edit via subforms work fine. Not so with main form. Set up a master-detail form-subform using two views linked from SQL Server. The subform allows inserts an updates, while the main form will not. The only solution I can think of is to recreate using tables imported from SQL Server, so that the data is all local. This is despite the fact that the views in SQL...
0
1426
by: Deano | last post by:
I have a main/subform arrangement which works well. The main form's parent records are about employees. The subform calculates their salary. I have now decided that the user can enter some splits in a popup form that I have built. So they click the Splits button and they can enter e.g 0.4 and 0.6 or any combination as long as it comes back to 1 (the reason for this is so they can allocate parts of the salary to different code areas)....
3
13981
by: gsb58 | last post by:
Hi! A mainform is being used to show records from a table in an sql database. A button on the main form will load a new form that allows the user to add, delete, update and search certain records in the underlying table of the main form. My question:
7
1476
by: Will1234321 | last post by:
Hello, I am creating an Inventory database and have the following setup to track sales made. I have 2 tables, tblSales and tblSaleItems. tblSales has the following fields: InvoiceNum, Date, PayMethod, CustomerID, TaxExempt?, SalesNotes & SaleID(primary & autonumber). tblSaleItems has: ItemID, SalePrice, SaleQty, SaleID, SaleItemID(Primary, autonumber). These two tables are joined by the SaleID. I have a form tied to tblSales with places for...
0
1932
by: Richnep | last post by:
Hi all,. I have a small issue I would like to resolve with VBA. I have a form which it's fields are bound to a table. Within that form is a subform which is a subtable. Tables relationship is a one to many from the main table to the sub table.
3
2056
by: darnnnel | last post by:
Hi Everyone, I have a form “FormMain” on which i have a combo box which pulls values from a table. If the combo box does not have the choice the user is looking for, i added a button that opens a form “FormPopAdd” where the user can enter a new record for that combo box (the user must use a command button to save the new record). Once the user clicks the save button on the FormPopAdd form I have a piece of code that refreshes the original...
11
4039
by: OldBirdman | last post by:
I have a form with several bound textboxes. These are routinely updated by User. The table in RecordSource for this form currently has 8 fields not shown on this form, but which occasionally need to be changed by User. For this I have created an "Advanced" commandbutton, which opens a child form with controls to display the remaining fields. I tried using recordsetclone to put the child form on the same record and recordset as the main...
5
6601
by: kknb0800 | last post by:
Hi, I'm new to Access but I've searched for a long time for a solution but to no avail. What I'm trying to do is create an address database whereby the user is able to enter addresses through a form and then have the abilitly to generate address labels. I have 1 table called 'addresses'. Linked to this, I have a form called 'address form'. This is the main form. From here, the user is able to enter new contact details and scroll...
2
3071
by: Gavin Sequeira | last post by:
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...
0
8233
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
8675
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...
1
8334
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
8474
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...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4078
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
2604
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
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
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.