Select Case refreshment problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mabrynda
    New Member
    • Jan 2010
    • 24

    Select Case refreshment problem

    Hi folks,
    I have the following problem. In one of my forms (say FORM1) in ACCESS 2003, I have 3 toggle buttons which are inside a frame. Close to each of these buttons is a combox with a list of items. All the 3 comboxes correspond to 3 different categories (each list encircles one category) and are inside a TabControl (say TabCnt0). When the toggle button is pressed, the nearby list is shown (visible) and is available for the selection of the desired items, while the other two comboxes are then hidden.
    Everything works perfectly, except that one pretty annoying thing happens. Immediately after the form is opened, all the 3 comboxes are visible. As soon as you click on one of the toggle buttons or on the frame, the two unselected comboxes disappear (as it should be) but if you reopen the form again, the same problem happens. I tries several ways to "refresh" somehow the form when it opens but without success. Does anybody know how to make it work so that whenever I open the form I see only one of the 3 choices?

    Thanks in advance.

    Marcin

    PS The code I'm using right now is below:

    Code:
    Private Sub Frame5_Click()
    
    DoCmd.RunCommand acCmdRefresh
    
    Select Case Frame5
    
    Case 1
    CmbAssClass.Visible = True
    CmbReg.Visible = False
    CmbAssClassReg1.Visible = False
    CmbAssClassReg2.Visible = False
    
    
    Case 2
    CmbAssClass.Visible = False
    CmbReg.Visible = True
    CmbAssClassReg1.Visible = False
    CmbAssClassReg2.Visible = False
    
    
    Case 3
    CmbAssClass.Visible = False
    CmbReg.Visible = False
    CmbAssClassReg1.Visible = True
    CmbAssClassReg2.Visible = True
    
    End Select
    
    End Sub
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    First off, you need to take your code out of the Frame5_Click() event and move it to the Frame5_AfterUpd ate() event. The Click event will fire if the frame itself is clicked, not only if one of the toggles is clicked, and can cause an error.

    Next, for the proper comboboxe(s) to show/not show, when the form opens and when moving from record to record, you need to also have the same code in the Form_Current() event.

    Linq ;0)>

    Comment

    Working...