Results 1 to 8 of 8
  1. #1
    lfox is offline Novice
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Posts
    7

    Question Triple State checkbox scroll order


    I have designed a database containing a list of inventory items. I have designed a form for users to report the individual items as either good or bad. The check boxes in the form report to the database fields which are set as integers. Within the form, the check boxes are set as triple state and defaulted to false. I'd like to change the order in which the boxes scroll. They presently scroll false>null>true. I'd like them to scroll as false>true>null. I'm not very proficient with VB Script. Is someone able to help? Thank you.

  2. #2
    is49460 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2010
    Posts
    40
    Create afterUpdate event for the checkbox and add the following code to it:

    If IsNull(Me.chkStatus) Then
    Me.chkStatus = True
    ElseIf Me.chkStatus = False Then
    Me.chkStatus = Null
    Else
    Me.chkStatus = False
    End If

    change chkStatus in every occurrence above to the actual name of your checkbox. it should do the trick. I hope that helps!

  3. #3
    lfox is offline Novice
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Posts
    7
    Unfortunately, it didn't work. I received this error:
    "The expression After Update you entered as the event property setting produced the following error: Member already exists in an object module from which this object module derives.

    *The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
    *There may have been an error evaluating the function, event, or macro.

    This error occurs when an event has failed to run because Microsoft Access cannot evaluate the location of the logic for the event. For example, if the OnOpen property of a form is set to =[Field], this error occurs because Access expects a macro or event name to run when the event is fired."

    Here is the code that I entered:

    Private Sub Check570_AfterUpdate()
    If IsNull(Me.Check570) Then
    Me.Check570 = True
    ElseIf Me.Check570 = False Then
    Me.Check570 = Null
    Else
    Me.Check570 = False
    End If
    End Sub

    Any Ideas?

  4. #4
    is49460 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2010
    Posts
    40
    the function itself looks right. The name of the function is duplicated somewhere. check out this reference: http://support.microsoft.com/kb/279124
    try to rename the checkbox and then recreate function with the new name.

  5. #5
    lfox is offline Novice
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Posts
    7
    Thanks for the KB topic. I've looked everywhere. I can't seem to find where it is duplicated. The text box linked to the check box has a different name. I changed the name of the caption to something different and that still didn't help. Might you have any other ideas? I appreicate the help!

  6. #6
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    Try deleting your function (or just cut + pasting it to Notepad or something). Once the function's been removed from the Form, do a search for "Check570_AfterUpdate" with "Current Module" selected in the Search field.

    If this is a Subform, you'll want to check the code in the parent Form as well.

  7. #7
    is49460 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2010
    Posts
    40
    Quote Originally Posted by lfox View Post
    Thanks for the KB topic. I've looked everywhere. I can't seem to find where it is duplicated. The text box linked to the check box has a different name. I changed the name of the caption to something different and that still didn't help. Might you have any other ideas? I appreicate the help!

    The linked textbox has nothing to do with the checkbox name. Access wouldn't let you have two (or more) objects with the same name. Caption of textbox is different from its name. In Design mode click on the checkbox itself (on the very top of property sheet you should see "Selection Type: Check Box"); on property sheet go to tab "other"; change property Name: "Check570" to "chkStatus"; click on events tab; recreate "after Update" event with the same code as before; Once you paste the code you should have something like this:

    Private Sub chkStatus_AfterUpdate()
    If IsNull(Me.chkStatus) Then
    Me.chkStatus = True
    ElseIf Me.chkStatus = False Then
    Me.chkStatus = Null
    Else
    Me.chkStatus = False
    End If
    End Sub


    make sure all the names correspond to the new name of the checkbox. should work!!
    If still doesn't work try to recompile the project (VBA window --> debug -->recompile). I can't think of anything else without looking at the code; anyone else any suggestions?

  8. #8
    lfox is offline Novice
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Posts
    7
    Got it! Thanks! I was going to try and attach my db to this. In doing so, I realized that I had the trust settings set to disable all macros. I enabled them and it works perfectly. Thanks for all the help!

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

Similar Threads

  1. Help on macro to scroll one record back?
    By getholdofjoru in forum Forms
    Replies: 2
    Last Post: 06-19-2010, 03:01 PM
  2. Adding Scroll bar to a form
    By Kesar in forum Access
    Replies: 1
    Last Post: 06-02-2010, 02:57 PM
  3. Replies: 1
    Last Post: 12-10-2009, 09:58 PM
  4. Pause state?
    By Zermoth in forum Programming
    Replies: 1
    Last Post: 12-15-2008, 05:05 AM
  5. Auto Scroll in a Form
    By delliott777 in forum Forms
    Replies: 0
    Last Post: 05-31-2008, 07:02 AM

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