Custom row source for combo box in continuous form in Access

后端 未结 13 2203
北恋
北恋 2020-12-06 01:34

I have searched around, and it seems that this is a limitation in MS Access, so I\'m wondering what creative solutions other have found to this puzzle.

If you have a

13条回答
  •  無奈伤痛
    2020-12-06 02:30

    This seems to work well. CBOsfrmTouchpoint8 is a combobox shortened to just the dropdown square. CBOsfrmTouchpoint14 is a textbox that makes up the rest of the space. Never say never:

      Private Sub CBOsfrmTouchpoint8_Enter()  
    
      If Me.CBOsfrmTouchpoint8.Tag = "Yes" Then  
      CBOsfrmTouchpoint14.SetFocus  
      Me.CBOsfrmTouchpoint8.Tag = "No"  
      Exit Sub  
      End If  
    
      Me.CBOsfrmTouchpoint8.Tag = "No"  
      Me.CBOsfrmTouchpoint8.RowSource = "XXX"  
      Me.CBOsfrmTouchpoint8.Requery  
      Me.CBOsfrmTouchpoint8.SetFocus  
      End Sub 
    
      Private Sub CBOsfrmTouchpoint8_GotFocus()  
      Me.CBOsfrmTouchpoint14.Width = 0  
      Me.CBOsfrmTouchpoint8.Width = 3420  
      Me.CBOsfrmTouchpoint8.Left = 8580  
      Me.CBOsfrmTouchpoint8.Dropdown  
      End Sub
    
      Private Sub CBOsfrmTouchpoint8_LostFocus()  
      Me.CBOsfrmTouchpoint8.RowSource = "XXX"  
      Me.CBOsfrmTouchpoint8.Requery  
      End Sub 
    
      Private Sub CBOsfrmTouchpoint8_Exit(Cancel As Integer)  
      Me.CBOsfrmTouchpoint14.Width = 3180  
      Me.CBOsfrmTouchpoint8.Width = 240  
      Me.CBOsfrmTouchpoint8.Left = 11760  
      Me.CBOsfrmTouchpoint8.Tag = "Yes"  
      End Sub
    

提交回复
热议问题