Automate fields based on current date on form load

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tmcjunkin
    New Member
    • Feb 2008
    • 1

    Automate fields based on current date on form load

    I'm trying to back into this project by defining what the user needs to see when they open a form. I'm between beginner and intermediate with vba, but have been using access for years.

    When the user opens the form they need to see the resident's current balance.

    The balance includes:
    Previous balance (which I can just pull in)
    Current rent (which needs to be based on the date the form is opened)
    Late fees (which needs to be based on the date the form is opened, IF the date is past the 5th of the month)

    I don't even know how to begin thinking about this.
    It would be great if someone could just get my thoughts processing in the right direction. I especially don't know how to automate a field on form load based on a current date.

    Thanks!
  • jyoung2
    New Member
    • Jan 2008
    • 32

    #2
    Assuming that Previous balance includes all months until the current one then
    This is the basic format I You may want to use fields on the form to store the varible so the people can see what they are charged for.

    There may be a better way to format this
    Code:
    CurrentRentDays = DateDiff("d", Format(Month(Now) & "/01", "mm/dd/yyyy"), Format(Now, "mm/dd/yyyy") + 1)
    CurrentRentDollars = CurrentRentDays  * RentPerDay
    if CurrentRentDays >= 5 then
    Latefee = 25
    else 
    LateFee = 0
    end if 
    
    AmountOwed = CurrentRentDollars + LateFee + BalanceForward
    Originally posted by tmcjunkin
    I'm trying to back into this project by defining what the user needs to see when they open a form. I'm between beginner and intermediate with vba, but have been using access for years.

    When the user opens the form they need to see the resident's current balance.

    The balance includes:
    Previous balance (which I can just pull in)
    Current rent (which needs to be based on the date the form is opened)
    Late fees (which needs to be based on the date the form is opened, IF the date is past the 5th of the month)

    I don't even know how to begin thinking about this.
    It would be great if someone could just get my thoughts processing in the right direction. I especially don't know how to automate a field on form load based on a current date.

    Thanks!

    Comment

    Working...