Results 1 to 4 of 4

Thread: Code help

  1. #1
    Join Date
    Oct 2005
    Posts
    55

    Unanswered: Code help

    Hi!

    I would like help in writing code that indicates that the result generated is greater than what is needed.

    For example I have a field where I enter the amount of leave John Paul takes. At the end of the month I calculate the total amount of leave John Paul takes.

    What I want to do is generate a message if John Paul total amount of leave exceeds say 17 days!

    How do I write code for that?

    Its an microsoft access database!

    Thanks for the help!

  2. #2
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    Do you have a field or table that has all the maximum days each person has? If so, why not just do check against that?
    Ryan
    My Blog

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Not enough info. What is this "result generated", how does that happen? We talking form, report, query? What constitutes a "generated message"? Is this an automated process?


    Actually, just Read This.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  4. #4
    Join Date
    Nov 2003
    Posts
    1,487
    Since you've given such little information you can try this:

    Code:
    If Nz(DLookup("[AmountOfLeaveDaysInTable]", "TableName", "[EmployeeName]='" & _
          Me.NameOfEmployeeOnForm & "'"), 0) > 17 Then
       MsgBox "H E Y ... " & Me.NameOfEmployeeOnForm & " Has Taken To Many " & _
              "Leave Days! - Fire Him/Her", vbExclaimation, "To Many Leave Days"
    End If
    .
    Environment:
    Self Taught In ALL Environments.....And It Shows!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •