Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Option box to filter combobox on subform 1

Status
Not open for further replies.

Leventcos21

Technical User
Oct 7, 2004
77
US
Hi, I have an option box that will filter a combobox in a subform. I am getting an error Jet engine could not find the table tblGroupSet with matching field(s) 'Groupset'

Code:
Private Sub grpGroupType_AfterUpdate()
    Me!sfrmTitle.Form.cboGroupSet.Value = Null
    Me!sfrmTitle.Form.cboGroupSet.Requery
        
    On Error Resume Next
    Dim strCodeType As String
    
    
    
        Select Case grpGroupType.Value
        Case 1
            strCodeType = "1"
        Case 2
            strCodeType = "2"
    End Select
    
    
    Me!sfrmTitle.Form.cboGroupSet.Value = "Select tblGroupSet.GroupSetNo, tblGroupSet.GroupSetName " & _
        "FROM tblGroupSet " & _
        "WHERE tblGroupSet.GroupTypeNo = '" & strCodeType & "' " & _
        "ORDER BY tblGroupSet.GroupSetName;"
 
try
Code:
Private Sub grpGroupType_AfterUpdate()
    
    Me!sfrmTitle.Form.cboGroupSet.recordsource= "Select tblGroupSet.GroupSetNo, tblGroupSet.GroupSetName " & _
        "FROM tblGroupSet " & _
        "WHERE tblGroupSet.GroupTypeNo = '" & grpGroupType & "' " & _
        "ORDER BY tblGroupSet.GroupSetName;"
 
Thanks for the reply.
I think my issue is coming from here. When I comment this out, I don't receive any error messages, however it doesn't filter either.


Code:
Private Sub grpGroupType_AfterUpdate()
    Me!sfrmTitle.Form.cboGroupSet.Value = Null
    Me!sfrmTitle.Form.cboGroupSet.Requery
 
How are ya Leventcos21 . . .

Perhaps this:
Code:
[blue]   Dim CBx As ComboBox, SQL As String
   
   Set CBx = Me!sfrmTitle.Form!cboGroupSet
   
   CBx = Null
   SQL = "Select GroupSetNo, GroupSetName " & _
         "FROM tblGroupSet " & _
         "WHERE (GroupTypeNo = " & Me![purple][b]grpGroupType[/b][/purple] & ") " & _
         "ORDER BY GroupSetName;"
   CBx.RowSource = SQL
   
   Set CBx = Nothing[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top