Welcome to SPN

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

Sign Up Now!

Evaluate Value after each step in process

Discussion in 'Information Technology' started by BlakeD@ChoctawRecovery.com, Jul 28, 2006.

  1. BlakeD@ChoctawRecovery.com

    BlakeD@ChoctawRecovery.com
    Expand Collapse
    Guest

    I have a code block that is effectively running some data validation
    checks. I have them in the Form_BeforeUpdate event, and am running the
    evalation from an outside module. Code looks like this:

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    On Error GoTo Error_Form_BeforeUpdate
    'Proceed with Data Checks until Exit or Cancel = True
    Cancel = modDataChecks.CheckData(Me.ADDRESS, 1, "Address")
    If True = Cancel Then Exit Sub
    End If
    Cancel = modDataChecks.CheckData(Me.FIRST_NAME, 1, "First
    Name")
    If True = Cancel Then Exit Sub
    End If
    Cancel = modDataChecks.CheckData(Me.LAST_NAME, 1, "Last Name")
    If True = Cancel Then Exit Sub
    End If

    Exit_Form_BeforeUpdate:
    Exit Sub

    Error_Form_BeforeUpdate:
    MsgBox Err.Description
    Resume Exit_Form_BeforeUpdate
    End Sub

    How can I make access evaluate the value of Cancel after each step and
    exit the sub if/when Cancel = True?
    I have tried Do While/Loop, While/Wend, but they all evaluate at the
    close of the loop / wend. Is there anything that evaluates after each
    step?
     
  2. Loading...

    Similar Threads Forum Date
    Sikh Values Blogs Oct 21, 2015
    Jainism Jainism and Sikhism: The Value of Being “Footnote” Traditions Interfaith Dialogues Jul 13, 2015
    World Why do we value gold? Breaking News Dec 9, 2013
    Canada Quebec's Charter of Values: If You Have A Personal Story, Please Share It Here! Breaking News Sep 19, 2013
    Canada Thousands March through Montreal to Protest Quebec Charter of Values (& Video) Breaking News Sep 16, 2013

  3. strive4peace

    strive4peace
    Expand Collapse
    Guest

    try this:

    '~~~~~~~~~~
    Dim mBoo as boolean, i as integer
    for i = 1 to 2 then
    select case i
    case 1
    mBoo = modDataChecks.CheckData( _
    Me.ADDRESS, 1, "Address")
    case 2
    mBoo = modDataChecks.CheckData( _
    Me.FIRST_NAME, 1, "First Name")
    end select
    if mBoo then
    CANCEL = true
    exit sub
    endif
    next i
    '~~~~~~~~~~~~~~`


    Warm Regards,
    Crystal
    Microsoft Access MVP 2006

    *
    Have an awesome day ;)

    remote programming and training
    strive4peace2006 at yahoo.com

    *

    BlakeD@ChoctawRecovery.com wrote:
    > I have a code block that is effectively running some data validation
    > checks. I have them in the Form_BeforeUpdate event, and am running the
    > evalation from an outside module. Code looks like this:
    >
    > Private Sub Form_BeforeUpdate(Cancel As Integer)
    > On Error GoTo Error_Form_BeforeUpdate
    > 'Proceed with Data Checks until Exit or Cancel = True
    > Cancel = modDataChecks.CheckData(Me.ADDRESS, 1, "Address")
    > If True = Cancel Then Exit Sub
    > End If
    > Cancel = modDataChecks.CheckData(Me.FIRST_NAME, 1, "First
    > Name")
    > If True = Cancel Then Exit Sub
    > End If
    > Cancel = modDataChecks.CheckData(Me.LAST_NAME, 1, "Last Name")
    > If True = Cancel Then Exit Sub
    > End If
    >
    > Exit_Form_BeforeUpdate:
    > Exit Sub
    >
    > Error_Form_BeforeUpdate:
    > MsgBox Err.Description
    > Resume Exit_Form_BeforeUpdate
    > End Sub
    >
    > How can I make access evaluate the value of Cancel after each step and
    > exit the sub if/when Cancel = True?
    > I have tried Do While/Loop, While/Wend, but they all evaluate at the
    > close of the loop / wend. Is there anything that evaluates after each
    > step?
    >
     

Share This Page