Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2011
    Posts
    413

    Unanswered: Form Criteria Less Than or = 0

    I have a form named frmEmpDeductions and on this form I have a text box named txtdeductions with format set to currency. Here is my code trying to popup a user message if there are no records with a amount less than or equal 0. The code is not working?

    If txtdeduction <= 0 Then MsgBox "There are no Employees with Payroll Deductions Due"

    DoCmd.Close

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Where do you place that code?
    Have a nice day!

  3. #3
    Join Date
    Nov 2011
    Posts
    413
    It is in the OnOpenEvent

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    I'm not sure that the value of a textbox is already available at that time. Try moving the statement to the Form_Current (or possibly Form_Load) event handler.
    Have a nice day!

  5. #5
    Join Date
    Nov 2011
    Posts
    413
    I tried that with no luck

  6. #6
    Join Date
    Nov 2011
    Posts
    413
    OK,I moved it to the on load event and it worked,however now I need the form to go ahead and open if the opposite is true.
    If txtdeduction >= 0 Then DoCmd.OpenForm
    Last edited by Burrina; 11-29-11 at 15:44. Reason: Make Clearer.

Posting Permissions

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