Results 1 to 10 of 10

Thread: employee app

  1. #1

    Thread Starter
    Banned
    Join Date
    Mar 2005
    Posts
    23

    employee app

    for x = 1 to 3
    employee = InputBox("Enter employee#")
    hoursworked = InputBox("Enter hoursworked")
    payrate = InputBox("Enter pay rat")
    print hoursworked,payrate,employee,hoursworked *payrate
    next x
    Last edited by crocker; Mar 26th, 2005 at 03:42 AM. Reason: RESOLVED

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: employee app

    You want it to print on a form?

  3. #3

    Thread Starter
    Banned
    Join Date
    Mar 2005
    Posts
    23

    Re: employee app

    How do I get it to pop up a messagebox where I can click OK
    Last edited by crocker; Mar 26th, 2005 at 03:42 AM.

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: employee app

    msgbox ("Your pay is: " & format(hoursworked *payrate, "$$$.00")

  5. #5
    Banned
    Join Date
    Mar 2005
    Posts
    26

    Re: employee app

    Dim a

    Private Sub Command1_Click()
    End
    End Sub

    Private Sub Form_Load()
    For x = 1 To 3
    employee = InputBox("Enter employee#")
    hoursworked = InputBox("Enter hoursworked")
    payrate = InputBox("Enter pay rat")
    a = hoursworked * payrate
    MsgBox "hoursworked, paypayrate, employee"
    MsgBox a
    Next x
    End Sub

  6. #6
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Re: employee app

    nonono!

    like so:

    VB Code:
    1. Dim a as integer
    2. dim exployee as string
    3. dim hoursworked as integer
    4. dim payrate as integer
    5.  
    6. Private Sub Command1_Click()
    7. End
    8. End Sub
    9.  
    10. Private Sub Form_Load()
    11. employee = InputBox("Enter employee#")
    12. hoursworked = InputBox("Enter hours worked")
    13. payrate = InputBox("Enter pay rate")
    14. a = hoursworked * payrate
    15. MsgBox "hoursworked, paypayrate, employee " & a
    16. End Sub

  7. #7
    Banned
    Join Date
    Mar 2005
    Posts
    26

    Re: employee app

    VB Code:
    1. Dim a As Integer
    2. Dim exployee As String
    3. Dim hoursworked As Integer
    4. Dim payrate As Integer
    5.  
    6. Private Sub Command1_Click()
    7. End
    8. End Sub
    9.  
    10. Private Sub Form_Load()
    11. For x = 1 To 3
    12. employee = InputBox("Enter employee#")
    13. hoursworked = InputBox("Enter hoursworked")
    14. payrate = InputBox("Enter pay rat")
    15. a = hoursworked * payrate
    16. MsgBox "hoursworked, paypayrate, employee " & a
    17. Next x
    18. End Sub

  8. #8
    Fanatic Member bob5731's Avatar
    Join Date
    Nov 2004
    Posts
    918

    Re: employee app

    I run and it works good.
    P.S. God Love You And Have A Good Day!!!My web page

    I need to get a free Iphone

  9. #9
    PowerPoster Simply Me's Avatar
    Join Date
    Aug 2003
    Posts
    2,748

    Re: employee app

    Quote Originally Posted by dos5731
    VB Code:
    1. Dim a As Integer
    2. Dim exployee As String
    3. Dim hoursworked As Integer
    4. Dim payrate As Integer
    5.  
    6. Private Sub Command1_Click()
    7. End
    8. End Sub
    9.  
    10. Private Sub Form_Load()
    11. For x = 1 To 3
    12. employee = InputBox("Enter employee#")
    13. hoursworked = InputBox("Enter hoursworked")
    14. payrate = InputBox("Enter pay rat")
    15. a = hoursworked * payrate
    16. MsgBox "hoursworked, paypayrate, employee " & a
    17. Next x
    18. End Sub
    I agree with dos5731 because the original post has to input 3 employees.
    To give is always to be NOBLE...
    To received is always to be BLESSED....
    Each day strive to be NOBLE
    Each day strive to be BLESSED

    If this post has helped you. Please take time to rate it.

    >=|+|=< Simply Me >=|+|=<

    ----------------------------------------
    Connection Strings | Number Only in Textbox | Splash Screen with Progress Bar | Printing to 1/2 of perforated bond paper |
    Freeze 2005 DataGridView Column

  10. #10
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: employee app

    Quote Originally Posted by dos5731
    VB Code:
    1. Dim a As Integer
    2. Dim exployee As String
    3. Dim hoursworked As Integer
    4. Dim payrate As Integer
    5.  
    6. Private Sub Command1_Click()
    7. End
    8. End Sub
    9.  
    10. Private Sub Form_Load()
    11. For x = 1 To 3
    12. employee = InputBox("Enter employee#")
    13. hoursworked = InputBox("Enter hoursworked")
    14. payrate = InputBox("Enter pay rat")
    15. a = hoursworked * payrate
    16. MsgBox "hoursworked, paypayrate, employee " & a
    17. Next x
    18. End Sub
    "a" should not be integer - it should be currency. Actually, they all need to be currency - do not use DOUBLE or SINGLE!

    a = hoursworked * payrate should be a = round(hoursworked * payrate,2). And be consistent - rounding errors are a nightmare in commercial payroll development.

    MsgBox "hoursworked, paypayrate, employee " & a should be

    MsgBox "hoursworked, paypayrate, employee " & Cstr(a)

    Respect your datatypes and do not allow VB to coerce them - always wrap in a function to match all datatypes in an expression.

    With that said:

    hoursworked = CCur(InputBox("Enter hoursworked"))

    You will need some kind of error trapping - this can blow up if odd values (non numeric) are entered.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

Posting Permissions

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



Click Here to Expand Forum to Full Width