This is driving me crazy, I've done it many times before but no code I use seems to be working for this project.
I have a Select query and a form with a simple combo box and command button on it. I want users to be able to select the Season they want to run, click the button and have the query run filtering it on the combo box selection.
What am I missing here? I can now get the query to run but it won't filter the results.
Private Sub cmdSeason_Click()
Dim strSQL As String
Dim strWhere As String
Dim stDocName As String
strWhere = "WHERE"
stDocName = "qSourceData_AllSeasons"
strWhere = strWhere & "[SELL SEASON] = '" & Me.cboSeason.Value & "'"
strSQL = "SELECT * " & "stDocName"
strSQL = "strWhere & strSQL"
DoCmd.OpenQuery stDocName, , , strSQL
Debug.Print
End Sub
Would appreciate any help. Haven't been able to find any threads addressing this which I find unusual so perhaps I'm searching for the wrong keywords: combo box, filter query, strWhere, strSQL, etc.
Thanks