473,378 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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

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 cmdUpdatePayments_Click()
Dim DB As DAO.Database
Dim rs As DAO.recordset
Dim rs1 As DAO.recordset

Set DB = CurrentDb
Set rs = DB.OpenRecordset("PBPurchases", dbOpenDynaset)
Set rs1 = DB.OpenRecordset("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 1478

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

Similar topics

9
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...
1
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...
0
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...
3
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...
7
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,...
0
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...
3
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...
11
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...
5
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...
2
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.