Welcome to SPN

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

Sign Up Now!

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
     

Share This Page