Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2006
    Posts
    39

    Unanswered: Need help to make a small marco with a condition, please

    A Macro that causes a warning box to be displayed any time a salary greater than $100,000 is entered using the Employee Form. The Warning message box shall warn that the salary to be entered is greater than $100,000. In all cases the data entry shall be allowed to proceed.

    The Employee Form is called the = EmployeeMC
    The salary field is in the employeeMC table.
    the salary field is called = emplsalarymc


    i tried, but it's wrong..
    ([Forms]![employeeMC]![emplsalarymc])>100000

    when i open the form, and type 1000000, it doesn't run automatically.

    how do i make it work?

    thanks in advance
    and it must be made with a marco
    Last edited by Chanyeehon; 11-17-06 at 19:43.

  2. #2
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,418
    Provided Answers: 7
    i would use the "Validation Rule" and "Validation Text"
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  3. #3
    Join Date
    Oct 2006
    Posts
    39
    Quote Originally Posted by myle
    i would use the "Validation Rule" and "Validation Text"
    but the assignment only wants me to use Marco
    i must

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    what have you been taught so far about macros?

    I think you may have a problme asking your question here, as most of the people who supply answers here tend not to use Macros, but intead wrap this sort of functionality in a validation rule or soem vb code that is attached to an event in a form.

    what have you attempted so far?

    where are you struggling?
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    I set up this problem, using your

    ([Forms]![employeeMC]![emplsalarymc])>100000 as the condition triggering the Action MsgBox and it runs as expected! I suspect your problem lies in how you're calling your macro. I used this code. You'll need to substitute the actual name of your macro. Mine is called SalaryValidation.

    Code:
    Private Sub emplsalarymc_BeforeUpdate(Cancel As Integer)
         DoCmd.RunMacro "SalaryValidation"
    End Sub
    Hope this helps!

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

    All posts/responses based on Access 2003/2007

  6. #6
    Join Date
    Oct 2006
    Posts
    39
    Quote Originally Posted by Missinglinq
    I set up this problem, using your

    ([Forms]![employeeMC]![emplsalarymc])>100000 as the condition triggering the Action MsgBox and it runs as expected! I suspect your problem lies in how you're calling your macro. I used this code. You'll need to substitute the actual name of your macro. Mine is called SalaryValidation.

    Code:
    Private Sub emplsalarymc_BeforeUpdate(Cancel As Integer)
         DoCmd.RunMacro "SalaryValidation"
    End Sub
    awesome
    it works
    you did it!!
    thanks a lot



    also thanks for the rest of the people to tried to help.
    Last edited by Chanyeehon; 11-18-06 at 16:10.

Posting Permissions

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