Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    rmoore is offline Advanced Beginner
    Windows XP Access 2016
    Join Date
    Feb 2020
    Posts
    47
    I deleted the code before uploading... I used the DB that i posted and its still not working

    Click image for larger version. 

Name:	Capture.JPG 
Views:	15 
Size:	103.2 KB 
ID:	41137

  2. #17
    rmoore is offline Advanced Beginner
    Windows XP Access 2016
    Join Date
    Feb 2020
    Posts
    47
    I was thinking maybe there is a problem because the PaymentAmount in the fAddLoans form is not linked to the PaymentAmount in the tPayments table. It is linked to the PaymentAmount in the tLoans table.

    Or Maybe because the LoanNumber is an Autonumber?

    Not sure, maybe I'm just grasping at straws at this point

    Attached is the newest DB copy with indexing changes and corrected names
    Attached Files Attached Files

  3. #18
    Join Date
    Apr 2017
    Posts
    1,687
    Attached is an example how to do all this, using saved queries and a helper table tNumbers (the table must have registered all consequent numbers at least to max possible number of payments).

    There is selection of 3 queries to append monthly payments (qAppendPaymentsM1 adds payments at 1st of month, qAppendPaymentsMD adds payments at same day of month, and qAppendPaymentsMEnd adds paymens at last day of month), and a query to append daily, weekly, and be-weekly payments. All queries are checking tPayments table for earlier appended payments, so no duplicates are inserted.

    User can run those queries at will from button event in form, or they can be called from some form event
    Attached Files Attached Files

  4. #19
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,967
    Your db and code is not working for first 2 records because there is no value in Frequency field. Select a value for record then click button. Records are then created in tPayments. For other records that already have Frequency, code works just fine.

    You need to be more explicit about what you mean by 'not working'. I am guessing you mean issue is with new record. New loan record must first be committed to table before payment records can be created.

    Add following line to button code just after Dim statement.

    If Me.Dirty Then Me.Dirty = False
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #20
    rmoore is offline Advanced Beginner
    Windows XP Access 2016
    Join Date
    Feb 2020
    Posts
    47
    Yes, I should of been more specific on what was going on... If i use the code as was, it doesn't insert a new payment record to tPayments on button click. If I close fAddLoan then open again cycle to any record previously saved and click button it will add the payment records.

    The
    Code:
    If Me.Dirty Then Me.Dirty = False
    has fixed that, Thanks

    ArviL suggestion of doing it through queries as another way of doing this is possible, do you have any thoughts on which way might be better (Users have limited computer experience)?

    As it stands... The PaymentAmount is not being inserted into the tPayments table. Ive added StartingBalance to the Loan table, My thinking is to use the "PaymentAmount" (Payment table) sums to calculate the remaining balance in a query. What is the best way to do it? Add "PaymentAmount" through editing the code or is somehow linking the field from the fAddLoan form a better option.

  6. #21
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,967
    AFAIK, this is a matter of preference.
    User experience is irrelevant. Code can run query objects just as well as SQL statement in code.
    I prefer to build as few query objects as possible.

    If you want to include payment amount in the INSERT action, then modify SQL statement to include appropriate references.

    Could pull payment amount from loan record but what if customer makes a payment different from what is scheduled? Edit the payment data at time of payment.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #22
    rmoore is offline Advanced Beginner
    Windows XP Access 2016
    Join Date
    Feb 2020
    Posts
    47
    Thanks for all the help..... After adding and tweaking I will update my progress..... Again June7 & ArviL you all have been great with the advice, suggestions and patience

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 10-16-2017, 06:47 PM
  2. Replies: 19
    Last Post: 10-03-2017, 09:10 AM
  3. append to one table using multiple tables
    By tagteam in forum Access
    Replies: 2
    Last Post: 06-27-2015, 07:29 AM
  4. Replies: 1
    Last Post: 11-16-2014, 09:10 AM
  5. Replies: 1
    Last Post: 10-06-2011, 08:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums