Payroll database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SamuelTad
    New Member
    • Jul 2014
    • 15

    Payroll database

    Wow!!! Thank you all who support me a lot to change an ideal one in to real Database.
    One more question,In my database I have fields called [status] and [Basic Salary].

    If [Status] = No, meaning eligible for pension deduction.
    So, Pension: [Basic salary]*0.07
    Else,
    [Status] = Yes, meaning not eligible.
    Pension: 0
    Therefore I need an expression which executes it.
    With regards!!!
  • twinnyfo
    Recognized Expert Moderator Specialist
    • Nov 2011
    • 3664

    #2
    Samuel,

    It appears you essentially have your code:

    Code:
    If Not [Status] Then
        Me.txtPension = [txtBasic salary] * 0.07
    Else
        Me.txtPension = 0
    End If
    I am not sure what else you would need on this one....

    Of course, mods need to be made to match the controls on your form....

    Comment

    • Seth Schrock
      Recognized Expert Specialist
      • Dec 2010
      • 2965

      #3
      Originally posted by SamuelTad
      Therefore I need an expression which executes it.
      How it executes it totally up to you. If you want it to run when you click a button, then you would put it in a button's On_Click event. If you want it to be automatic, then I would put it in a public function and then call the function as part of the form's recordsource. There are lots more options as well. What do you want to happen?

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32662

        #4
        Twinnyfo has it about right as for the logic. Maybe a simpler version :
        Code:
        With Me
            .txtPension = IIf([Status], 0, .txtBasicSalary * 0.07)
        End With

        Comment

        • SamuelTad
          New Member
          • Jul 2014
          • 15

          #5
          Thanks all! Your suggestion helps me a lot.

          Thanks I got the answer.
          Last edited by NeoPa; Aug 24 '14, 02:30 PM. Reason: This is one post.

          Comment

          Working...