Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1. Guest ji, please consider donating today!
      Become a Supporter    ::   Make a Contribution   
    Monthly Recurring Target: $300 :: Achieved: $95

Validation fail need to reset cursor to field

Discussion in 'Information Technology' started by GaryC, Jul 28, 2006.

  1. GaryC

    GaryC
    Expand Collapse
    Guest

    Hi I've performed validation on a field and have a MsgBox to say "invalid
    part number". Need to reset the field move the cursor back to the beginning
    of field and delete invalid data.

    I've tried the undo method, but it seems that whatever I do the cursor moves
    to the next field regardless of whether or not the validation fails.

    Your help is greatly appreciated

    Thanks
     
  2. Loading...


  3. Tom Wickerath

    Tom Wickerath
    Expand Collapse
    Guest

    Hi Gary,

    You can perform the validation during the Before_Update event procedure for
    either the control, or the form, and issue Cancel = True if the validation
    fails. If you cancel at the control level, focus should remain in the
    control. If you cancel the form's Before_Update, you can issue a
    DoCmd.SetFocus ControlName.

    I don't know that I would automatically delete the invalid data for the
    user; perhaps they're off by just one character of a 15 character part
    number. They might get rather upset with the database developer if they
    constantly have to re-enter the entire string whenever they commit a little
    data entry booboo.


    Tom Wickerath
    Microsoft Access MVP

    http://www.access.qbuilt.com/html/expert_contributors.html
    http://www.access.qbuilt.com/html/search.html
    __________________________________________

    "GaryC" wrote:

    > Hi I've performed validation on a field and have a MsgBox to say "invalid
    > part number". Need to reset the field move the cursor back to the beginning
    > of field and delete invalid data.
    >
    > I've tried the undo method, but it seems that whatever I do the cursor moves
    > to the next field regardless of whether or not the validation fails.
    >
    > Your help is greatly appreciated
    >
    > Thanks
     
  4. GaryC

    GaryC
    Expand Collapse
    Guest

    Thanks very much

    Gary

    "GaryC" wrote:

    > Hi I've performed validation on a field and have a MsgBox to say "invalid
    > part number". Need to reset the field move the cursor back to the beginning
    > of field and delete invalid data.
    >
    > I've tried the undo method, but it seems that whatever I do the cursor moves
    > to the next field regardless of whether or not the validation fails.
    >
    > Your help is greatly appreciated
    >
    > Thanks
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page