Setting the value of a "checkbox"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sueb
    Contributor
    • Apr 2010
    • 379

    #1

    Setting the value of a "checkbox"

    I'm trying to set a checkbox field in my table based on what the user enters into another field. The following code does everything right (display the box as the user leaves the field, accept the click and disappear) except actually set the checkbox value. I don't get an error. Am I using the wrong value for "Yes"? Or what?

    Private Sub Category_AfterU pdate()
    On Error GoTo Err_Category_Af terUpdate

    Dim myVAR As Byte

    'Make the user specify whether this IUR needs Radiology's signature
    If Me.Category.Val ue = "MRI" Then
    mVAR = MsgBox("Does Radiology need to sign this?", vbYesNo + vbQuestion)
    End If

    'If so, set the tag; otherwise, do nothing
    If myVAR = vbYes Then
    Me.Rad_Sig.Valu e = -1
    End If

    Exit_Category_A fterUpdate:
    Exit Sub

    Err_Category_Af terUpdate:
    MsgBox Err.Description
    Resume Exit_Category_A fterUpdate

    End Sub

    Thanks!
  • TheSmileyCoder
    Recognized Expert Moderator Top Contributor
    • Dec 2009
    • 2322

    #2
    Assumming the code is a direct copy/paste, its because you have a typo.
    mVar should have been myVar
    Code:
    mVAR = MsgBox("Does Radiology need to sign this?", vbYesNo + vbQuestion)
    Please read this article, it will save you ALOT of headaches!
    Require Variable Declaration

    Also when posting code, please remember to use the [Code] . . . [/Code] tags around your code.

    Comment

    • sueb
      Contributor
      • Apr 2010
      • 379

      #3
      Is my face red! I guess that's what I get for working too late too many days in a row.

      Now it's perfect--thanks for catching that!

      Comment

      Working...