Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Posts
    989
    Thanks
    0
    Thanked 0 Times in 0 Posts

    beforeupdate event (97)

    I have a text box control called txtSalary and want to check the amount and cancel it if it is greater than

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: beforeupdate event (97)

    You can use the following code :
    <pre>Private Sub txtSalary_BeforeUpdate(Cancel As Integer)
    If Me.Text0 > 50000 Then
    SendKeys "{esc}"
    Cancel = True
    End If
    End Sub</pre>

    Francois

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: beforeupdate event (97)

    Instead of <font face="Georgia">SendKeys "{Esc}"</font face=georgia>, one can also use

    <font face="Georgia">txtSalary.Undo</font face=georgia>

    This has the same effect (undoing changes to the control).

Posting Permissions

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