Message using IIF statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cwby1966
    New Member
    • Feb 2007
    • 49

    Message using IIF statement

    Hi
    I have a form that has a sub form. Want to add a text box that would didplay a message depending on different cirteria. The sub form list items to be followed up on, so if there was an item that was past due and not complete I want to diplay a message that there are past due items, same if there was an item that was due in the next 30 days.
    I have tried creating a text feild with a control coure using dcount but had not luck. Can anyone give some other ideas?
    Thanks
  • hyperpau
    Recognized Expert New Member
    • Jun 2007
    • 184

    #2
    The best solution I could think of as of the moment is to add a Form_Current() event to your form and use a function to compute the age of the balance. Dcount is not necessary for this only counts the number of records.
    A simple calculation would do.

    Lets say:
    I have a form with the fields:
    dteBillDate
    dteDueDate
    stMessage

    Now of course the dteBillDate and dteDueDate should already have records depending on how you set up the Due date field to populate.
    Then I have one record already where
    dteBillDate = 08/01/08
    dteDueDate = 08/30/08
    stMessage = No entries. (This can even be an unbound control)

    On the current event I will write this codes.

    Code:
    Private Sub Form_Current ()
    Dim intAge as Integer
    
    intAge = DateDiff("d", "dteBillDate", "dteDueDate")
    
    Select Case intAge
         Case  > 30
                   stMessage = "No Items past due yet."
        Case <  30
                  stMessage = "Items already past due for " & intAge & " days."
        Case <  60
                  stMessage = "Items already past due for more than 60 days."
    End Select
    End Sub


    Originally posted by cwby1966
    Hi
    I have a form that has a sub form. Want to add a text box that would didplay a message depending on different cirteria. The sub form list items to be followed up on, so if there was an item that was past due and not complete I want to diplay a message that there are past due items, same if there was an item that was due in the next 30 days.
    I have tried creating a text feild with a control coure using dcount but had not luck. Can anyone give some other ideas?
    Thanks

    Comment

    Working...