Results 1 to 5 of 5
  1. #1
    terryvanduzee is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    17

    Checkbox not working

    Hello

    I have a checkbox that I have some code written on the "Afterupdate" event.
    I checked the value of the checkbox both checked and unchecked; it comes up as -1 and 0.
    In my code, I am checking the value for being true or false, but it does not seem to see it as true or false:

    In the table design, I have it designated as "True/False".


    Neither true or false seems to run my code, just jumps to the end if.

    Code:
    If Me.Item_Sold = True Then 'this is my checkbox
    
        Dim name As String
        Dim box As String
        
        Select Case Me.Itemname.Value
            Case Is = "Embrace"
                Me.Itemname.Value = "Embrace Odd Boxspring"
                Me.Item_OddBox.Value = "Semi-Flex"
            Case Is = "Majestic Pearl"
                Me.Itemname.Value = "Majestic Pearl Odd Boxspring"
                Me.Item_OddBox.Value = "Majestic Pearl Odd Boxspring"
            Case Is = "Chiro-Majestic"
                Me.Itemname.Value = "Chiro-Majestic Odd Boxspring"
                Me.Item_OddBox.Value = "Chiro-Majestic Odd Boxspring"
            Case Is = "Camden"
                Me.Itemname.Value = "Camden Odd Boxspring"
                Me.Item_OddBox.Value = "Camden Odd Boxspring"
            Case Is = "Jubilee"
                Me.Itemname.Value = "Jubilee Odd Boxspring"
                Me.Item_OddBox.Value = "Jubilee Odd Boxspring"
            Case Is = "Ameripedic II Plush"
                Me.Itemname.Value = "Ameripedic II Plush Odd Boxspring"
                Me.Item_OddBox.Value = "Ameripedic II Plush Odd Boxspring"
            Case Is = "Ameripedic II Pillow Top"
                Me.Itemname.Value = "Ameripedic II Pillow Top Odd Boxspring"
                Me.Item_OddBox.Value = "Ameripedic II Pillow Top Odd Boxspring"
            Case Is = "Hotel"
                Me.Itemname.Value = "Tan Odd Boxspring"
                Me.Item_OddBox.Value = "Tan Odd Boxspring"
            Case Else
                Me.Itemname.Value = "Snow"
                Me.Item_OddBox.Value = "Snow"
        End Select
    End If
    Any Ideas
    Thank you
    Terry

  2. #2
    SoftwareMatters is offline Access VBA Developers
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Dorset
    Posts
    274
    Try changing Me.Item_Sold to Me!Item_Sold or why don't you just put If Me!Item_Sold = -1 Then

  3. #3
    Pimped is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2009
    Posts
    25
    -1 is true
    0 is false

    in vba, you can set a break point by clicking in the left ruler area so that the program stops at that point and you can hover your mouse over the items to see their values.

    If (Me.Item_Sold = -1) Then

  4. #4
    terryvanduzee is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    17

    checkbox not working

    Hello

    Yes, I set a breakpoint. I tried using 0 and -1. The problem was mine... a typo, I had the name of the object misspelled.

    Thank you for your suggestions.

    Terry

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If you have:
    Option Explicit
    ...at the top of your module, it will catch most spelling issues.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Toggle checkbox
    By stewarta in forum Programming
    Replies: 9
    Last Post: 04-16-2009, 02:45 PM
  2. Checkbox
    By Rbtsmith in forum Access
    Replies: 2
    Last Post: 02-17-2009, 04:19 PM
  3. Replies: 0
    Last Post: 01-06-2009, 03:27 PM
  4. checkbox
    By Suresh in forum Forms
    Replies: 0
    Last Post: 12-19-2007, 01:30 AM
  5. access checkbox
    By nshack31 in forum Forms
    Replies: 1
    Last Post: 12-09-2005, 10:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums