Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Add Other Payment
James Hopkins 
     
3 years ago
Hey Guys, I am trying to figure out how to make Multiple or Add Other Payment using an "Add Invoice Payment" Button on the Payment Form. I want to using the same 'Invoice #(s) and Customer Name to create the New Payment.
Adam Schwanz  @Reply  
           
3 years ago
Sorry could you explain a little more or add pictures? I don't see what you're trying to do.
James Hopkins OP  @Reply  
     
3 years ago

James Hopkins OP  @Reply  
     
3 years ago

James Hopkins OP  @Reply  
     
3 years ago

Kevin Yip  @Reply  
     
3 years ago
Hi James, as I said in the other thread ( https://599cd.com/a?70919 ), your table setup needs to accommodate multiple payments to a single invoice (and/or vice versa).  You won't be able to make any forms or code to do that until you have a many-to-many table relationship as I mentioned.  Here is the table setup suggestion again:

TransactionID     TransactionDate     PaymentID     InvoiceID     PaymentApplied
1                 5/5/23              100           11223         $100
2                 5/20/23             101           11223         $200
3                 6/1/23              200           33445         $1500
4                 6/1/23              200           44556         $800
5                 8/20/23             520           11223         ($50)

This how you relate multiple payments (payment ID 100 and 101) to a single invoice (ID 11223), or one payment (ID 200) to multiple invoices (ID 33445 and 44556).
James Hopkins OP  @Reply  
     
3 years ago
Hey I came up with a VBA Code to try get this done:

Private Sub BtnAddInvoicePayment_Click()

Dim selectedInvoice As String
Dim clientName As String
Dim newPaymentID As Long

' Get the Selected Invoice Number and Client Name from the Form Controls

selectedInvoice = Me.InvoiceIDNumber.Value
customerName = Me.ClientName.Value

' Generate a New Payment ID or Retrieve it from a Sequence
newPaymentID = GetNewPaymentID()

' Add the New Payment Record to the Payment Table
DoCmd.RunSQL "INSERT INTO Payment (PaymentID, InvoiceIDNumber, ClientName) " & _ "VALUES (" & newPaymentID & ", '" & selectedInvoice & "', '" & clientName & "')"

' Optional: Update the Form or display a Confirmation Message
Me.Requery
MsgBox "Payment added Successfully!"

' Clear the Selected Invoice and Client Name fields for Adding Another Payment
Me.InvoiceIDNumber.Value = "" Me.ClientName.Value = ""

End Sub

' Function to Generate a New Payment ID (assuming an Auto-Incrementing Primary Key)
Function GetNewPaymentID() As Long

Dim rst As DAO.Recordset
Dim newID As Long

Set rst = CurrentDb.OpenRecordset("SELECT MAX(PaymentID) AS MaxID FROM Payment")

If Not rst.EOF Then
newID = rst!MaxID + 1 Else newID = 1

End If

rst.Close
Set rst = Nothing
GetNewPaymentID = newID

End Function
James Hopkins OP  @Reply  
     
3 years ago
Hey Richard, do you think that as VBA Code would to Generate Additional Payments for "Invoice Number" and/or "Client's Invoice(s)" correctly?
Richard Rost  @Reply  
          
3 years ago
Without reading thru your code... explain to me in English exactly what you're trying to do.
James Hopkins OP  @Reply  
     
3 years ago
Richard, I am trying to write an VBA Code that I can "Add Additional Payment(s)" for Invoice or apply the Extra Payment Amount to"Other Client Invoices".
Richard Rost  @Reply  
          
3 years ago
OK, I cover this topic extensively in Access Developer 7.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 4/30/2026 7:09:38 AM. PLT: 1s