Results 1 to 10 of 10
  1. #1
    Join Date
    May 2005
    Posts
    150

    Unanswered: Before Update.. if chkValue = -1 Don't update

    With a couple of the controls in the before update I want it to check if a value in a table is -1. If the value is -1 I don't want it to update the control. How do I tell Access to not update the control?

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Cancel = -1
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    May 2005
    Posts
    150

    thanks

    You are making things go smoothly... thank you sir

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Being picky:- it might be more stable, over the long term to change the code to

    Code:
    if([chkvalue]=1) then
      cancel=vbtrue
    else
      cancel = vbfalse
    endif
    the reason then if Microsoft change the value of false then the intrinsic constant within vb will always set true or false.

  5. #5
    Join Date
    May 2005
    Posts
    150

    Still issues...

    For some reason using the Cancel = vbTrue it won't let me out of the field

    Code:
    Dim cmbBTo As String
    
    cmbBTo = Nz(Me.cmbBillTo, "")
    
    If cmbBTo <> "" Then
    Dim askChange As VbMsgBoxResult
    
    askChange = MsgBox("Are you sure you want to change the Bill To?", vbYesNo, "Make Change?")
    
    If askChange = vbNo Then
    Cancel = vbTrue
    
    End If
    
    End If
    Where did I go wrong?

  6. #6
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    What happens exactly? Is there anything else in your event?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  7. #7
    Join Date
    May 2005
    Posts
    150
    thanks for the quick reply....

    there is nothing else in the event...

    What i'm trying to do is when you select a different billto it will prompt you and ask if you are sure you want to make the change. You select No and then it goes back to the original Billto chosen. If Yes then it changes the billto to the one that was selected.

    After selecting a different billto it prompts asking if you want to make changes...

    If it hit yes it changes fine...

    If I hit No then it still shows the changed data and not the original. and if i try and tab out of the field I get stuck in a loop of it asking me to change the billto

    but it never changes the billto back to the original

  8. #8
    Join Date
    May 2005
    Posts
    150
    any ideas?

  9. #9
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    i don't do bound-world, but perhaps it is worth looking at the .oldValue property if the data is not yet saved in the table (i.e. if me.dirty = true)

    something like

    dim blah as control
    for each blah in me.controls
    blah.value = blah.oldvalue
    next

    no guarantees tho...

    izy
    currently using SS 2008R2

  10. #10
    Join Date
    May 2005
    Posts
    150
    the old value worked great.

Posting Permissions

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