Results 1 to 8 of 8
  1. #1
    Join Date
    May 2006
    Posts
    386

    Unanswered: Is it possible to get a message alert as soon as the user clicks on the employee name

    Dear Friends,

    I would be most grateful if some one can help me on this.
    My boss has asked me to create a code on the Form to alert (give a message) the user regarding the employee's suitability for a particular job. For example, it is the company's policy that all its employees should be qualified in Health & Safety.

    Lets assume, Robert is not qualified in Health and Safety and if I want to assign him for a job and as soon as I click on his name, I should be given a message flagging (saying) This employee is not Qualified in Health & Safety.

    Any help would be greateful appreciated.
    Emi-UK
    Love begets Love, Help Begets Help

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    What conditions in the database identify that Robert is not qualified in H&S? Is it a related qualification record missing or a yes/no field in the employee's table?

    You have to help us to help you!
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    May 2006
    Posts
    386
    Hi StarTreckker,
    I am sorry that I forgot to mention this, yes it is a yes/no field.
    Last edited by Emal; 09-17-09 at 20:23.
    Emi-UK
    Love begets Love, Help Begets Help

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I'd most likely put some code in the OnCurrent event of the form which "tests" the value of this yes/no field.

    ie.

    if me!Myfieldname = true or me!Myfieldname = -1 then
    msgbox "Myfieldname is Yes."
    end if
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  5. #5
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    ▲ What PK said
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  6. #6
    Join Date
    May 2006
    Posts
    386
    Hi, success made! I finally managed to work it out by writing the following code:

    Private Sub EmployeeID_Click()
    If Me!Qualified = False Or Me!Qualified = "No" Or IsNull(Me!Qualified) Then
    MsgBox "This Employee is Not Qualified"
    End If
    End Sub
    Thanks for your advice and help.
    Emi-UK
    Love begets Love, Help Begets Help

  7. #7
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    But that will only work if you actually click on the EmployeeID object. If you do what we suggested (put it in Form_Current), then it will fire as soon as you look at the record.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  8. #8
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    And since it's in the Click event of the (I assume) textbox, the message will fire if/when the user clicks into the field to initially enter the employee ID or to edit it! Go with what PK and StarTrekker said; put it in the Form_Current event!
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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