Results 1 to 4 of 4
  1. #1
    dccjr's Avatar
    dccjr is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Location
    Colorado Springs, CO
    Posts
    138

    No Results on Requery for Combobox RowSource

    I probably just need a second set of eyes on this, but I am populating a combo box with result from a query based on two criteria (Report type and Constraint type). I have the following, but it isn't throwing any error. It just does not populate the combobox.



    Code:
    Public Sub cboConstraint_AfterUpdate()
    Dim strTrendSQL As String
    Dim strParetoSQL As String
    Dim strConEventReportSQL As String
    Dim strConEventSummarySQL As String
    strParetoSQL = ""
    strConEventReportSQL = ""
    strConEventSummarySQL = ""
    Me.cboConValue.RowSource = ""
    If Me.cboConstraint.Value = "Specific Date to Present" Then
        Me.fraConValue.Visible = False
        Me.cboConValue.Visible = False
        Me.txtDate.Visible = True
        Me.fraDate.Visible = True
    Else
        Me.fraConValue.Visible = True
        Me.cboConValue.Visible = True
        Me.txtDate.Visible = False
        Me.fraDate.Visible = False
    End If
        Select Case Me.fraReport.Value
            Case 1
                Select Case Me.cboConstraint.Value
                    Case "Work Order"
                        strConEventReportSQL = "SELECT WorkOrderNo, QualityNo FROM RCAData1 ORDER BY RCAData1.WorkOrderNo;"
                        Me.cboConValue.ColumnCount = 2
                        Me.cboConValue.RowSource = strConEventReportSQL
                        Me.cboConValue.Requery
                    Case "Quality"
                        strConEventReportSQL = "SELECT QualityNo, WorkOrderNo FROM RCAdata1 ORDER BY RCAData1.QualityNo;"
                        Me.cboConValue.ColumnCount = 2
                        Me.cboConValue.RowSource = strConEventReportSQL
                        Me.cboConValue.Requery
                End Select
            Case 2
                Select Case Me.cboConstraint.Value
                    Case "Event Type"
                        strConEventSummarySQL = "SELECT DISTINCT Type FROM RCAData1;"
                        Me.cboConValue.ColumnCount = 1
                        Me.cboConValue.RowSource = strConEventSummarySQL
                        Me.cboConValue.Requery
                    Case "Event Category"
                        strConEventSummarySQL = "SELECT DISTINCT Category FROM RCAData1;"
                        Me.cboConValue.ColumnCount = 1
                        Me.cboConValue.RowSource = strConEventSummarySQL
                        Me.cboConValue.Requery
                    Case "Work Area/Cell"
                        strConEventSummarySQL = "SELECT DISTINCT AreaCell FROM RCAData1;"
                        Me.cboConValue.ColumnCount = 1
                        Me.cboConValue.RowSource = strConEventSummarySQL
                        Me.cboConValue.Requery
                End Select
            Case 3
                Call ExportRecordsetToExcel
            Case 4
                Call ExportRecordsetToExcel
        End Select
    End Sub
    Public Sub cboConValue_AfterUpdate()
    Dim strEventReportSQL As String
    Dim strEventSummarySQL As String
    Select Case Me.fraReport.Value
        Case 1
            Select Case Me.cboConstraint.Value
                Case "Work Order"
                    strEventReportSQL = "SELECT * FROM RCAData1 WHERE RCAData.WorkOrderNo = '" & Me.cboConValue.Value & "';"
                Case "Quality"
                    strEventReportSQL = "SELECT * FROM RCAData1 WHERE RCAData1.QualityNo = '" & Me.cboConValue.Value & "';"
            End Select
        Case 2
            Select Case Me.cboConstraint.Value
                Case "Event Type"
                    strEventSummarySQL = "SELECT * FROM RCAData1 WHERE RCAData1.Type = '" & Me.cboConValue.Value & "';"
                Case "Event Category"
                    strEventSummarySQL = "SELECT * FROM RCAData1 WHERE RCAData1.Category = '" & Me.cboConValue.Value & "';"
                Case "Work Area/Cell"
                    strEventSummarySQL = "SELECT * FROM RCAData1 WHERE RCAData1.AreaCell = '" & Me.cboConValue.Value & "';"
            End Select
    End Select
    End Sub
    It seems like the more I learn, the more I miss the obvious. Anyone one see what I am missing?

  2. #2
    dccjr's Avatar
    dccjr is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Location
    Colorado Springs, CO
    Posts
    138
    Got it! Needed [] around the each selected fields.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Odd, [] should only be needed if field names have spaces or special characters or are reserved words.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    dccjr's Avatar
    dccjr is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Location
    Colorado Springs, CO
    Posts
    138
    You are absolutely correct. I just realized that this wasn't what fixed it. I am really embarrassed now. The Row Source Type was incorrect. Feel free to hurl insults now. They are deserved. Thanks.

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

Similar Threads

  1. Replies: 1
    Last Post: 03-07-2013, 05:12 PM
  2. combobox rowsource per row on a subform
    By kowalski in forum Access
    Replies: 2
    Last Post: 12-05-2012, 01:49 AM
  3. Wildcard search within ComboBox to control RowSource
    By CaptainKen in forum Programming
    Replies: 22
    Last Post: 05-16-2012, 02:19 PM
  4. combobox rowsource
    By dirkvw in forum Forms
    Replies: 3
    Last Post: 06-20-2011, 05:12 PM
  5. ComboBox Search - No Results
    By cvansickle in forum Forms
    Replies: 5
    Last Post: 03-27-2011, 03:37 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