Results 1 to 8 of 8
  1. #1
    chuki2 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2011
    Location
    Selangor,Malaysia
    Posts
    26

    How to read last record using VBA?

    Hello there....i need a help...

    I need to create finance system,

    On table,i have name,memo,credit,debit and balance



    So when i put new record,it will read [balance] last record before to plus or minus and save it....

    Any idea?

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    This type of value should not be kept on a table as it is a calculated field and changes all the time. Whenever you need it, recalculate it - whether for forms or reports. I would suggest keeping a permanent query which calculates it correctly and whenever you need to display the value you can reference the query.

  3. #3
    chuki2 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2011
    Location
    Selangor,Malaysia
    Posts
    26
    Hmmmm i see...

    If i have 3 table,how to calculate it? need make relationship?

  4. #4
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    I think the credit and debit amounts are both on one table? Thus it would be a simple query to total and subtract one from the other.

    If it is more complicated than that, tell me what your formula looks like.

  5. #5
    chuki2 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2011
    Location
    Selangor,Malaysia
    Posts
    26
    Yup that right....credit and debit both on one table...

    Ok here,i have 2 table....one called tblCustomer,tblAccountingCustommer and tblOfficeAcount

    tblCustomer is link to tblAccountingCustomer and tblOfficeAccount

    So when customer make payment,it will save to tblAccountingCustomer for record and tblOfficeAccount for debit...

    Let say column on tblOfficeAccount have debit,credit,date and time and balance

    So if in query? how i can calculated?

    And if customer make payment,how i can read last balance on tblOfficeAccounting to plus on balance?

    I hope you understand... Thank you so much my friends...

  6. #6
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    I'm not sure I do understand!

    Your query can link tblCustomer and tblOfficeAccount, then using the Totals you can Sum the debit and credit amounts and you can also sum them together to get the balance. Do not try and keep the balance on the tables anywhere.

  7. #7
    chuki2 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2011
    Location
    Selangor,Malaysia
    Posts
    26
    Hrmm.... i still can`t imagine...hehe..

    Is ok,i will try my best...if anything problem,i will ask again...thanks for help my friends...

  8. #8
    chuki2 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2011
    Location
    Selangor,Malaysia
    Posts
    26
    ****************************
    | debit | kredit | remaining |
    ****************************
    | $230 | $0 | $230 |
    | $0 | $120 | $110 |

    Look like this....hehe,can u imagine?

    So if in query? what formula i need to create?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. MDB in Read Only, No .ldb, What to do
    By schwimms in forum Access
    Replies: 11
    Last Post: 02-25-2015, 03:12 PM
  2. VBA Record Set - Read Only
    By Scyclone in forum Programming
    Replies: 8
    Last Post: 10-18-2011, 07:10 AM
  3. Button on a Form to make record read only
    By billgyrotech in forum Forms
    Replies: 8
    Last Post: 08-08-2011, 03:28 PM
  4. Allow Read or Update dep on record
    By AndreT in forum Forms
    Replies: 2
    Last Post: 07-31-2011, 09:46 PM
  5. Replies: 2
    Last Post: 10-19-2006, 04:37 PM

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