Results 1 to 3 of 3
  1. #1
    cp1981 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Location
    Northeast Missouri
    Posts
    33

    Using data from table to populate txtbox in form from arithmetic argument

    Hope I summed up my question good enough lol



    Ill chalk this up as a newbie question because it seems easy, but I just dont know my way around VBA enough to cough it all up and make it work.

    Im designing a personal budget/expense tracker database. Im about to design a form that when I type information about a certain expense/bill and the amount that I owe or is due and the amount that i pay displays a text string from another table (tblStatus) i.e. "Paid- In full", "Paid- Partial", etc and also when I pull up the account that im paying on, the due date from the account compares to the current date and in a text box tells me whether Im "Past Due" or as long as Im within lets say within 1 week of the due date, "Due".

    Currently I have (what will correspond to what I want to do):

    tblAccount Includes fields "DueDate" and "Amount" (Due)
    tblPaymentStatus Includes strings "Paid- In Full", "Paid- Partial", "Due", "Overdue"
    tblTransaction Includes fields "TransactionDate" (Paid Date), "AmountPaid", "Status" (Where I want the "Status" string to appear)

    qryNonRecurringAccount Shows my non-Recurring Accounts
    qryRecurringAccount Shows Recurring accounts
    qryBankATransaction What comes out/in to Bank A
    qryBankBTransaction What comes out/in to Bank B

    Also, like the Northwind DB on the main page, I would like to see what accounts are due and overdue through a datasheet view as well as show a pie chart of expenses.

    I by no means expect anyone to do the leg work for me. Point me in the right direction or tell me what to search for or get educated about specifically.

    Any help would be very much appreciated and gratefull.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    I think you need 2 functions for your queries (or form), to give the results on the fly. Just submit the field in query: getDueStatus([DueDate]) as DueStatus.

    Code:
    Public Function getDueStatus(ByVal pvDueDate)
        Select Case pvDueDate
          Case Is < Date
            getDueStatus = ""
        
          Case Is = Date
            getDueStatus = "Due"
        
          Case Else
            getDueStatus = "Overdue"
        End Select
    End Function
    
    Public Function getPaidStatus(ByVal pvAmtPd, ByVal pvAmtDue) As String
    Select Case pvAmtPd
      Case 0
        getPaidStatus = "Total Due"
      Case Is < pvAmtDue
        getPaidStatus = "Paid- Partial"
      Case Else
        getPaidStatus = "Paid- In full"
    End Select
    End Function

  3. #3
    cp1981 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Location
    Northeast Missouri
    Posts
    33
    Thanks ranman. Much appreciated. Got it running good.

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

Similar Threads

  1. Arithmetic with Access
    By Broxi in forum Access
    Replies: 1
    Last Post: 07-28-2013, 07:57 AM
  2. Replies: 6
    Last Post: 08-23-2012, 05:06 AM
  3. Replies: 3
    Last Post: 10-09-2011, 08:55 AM
  4. Replies: 0
    Last Post: 05-12-2010, 10:08 PM
  5. form data will not populate in table
    By bobsakamato in forum Access
    Replies: 1
    Last Post: 09-06-2009, 07:25 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