PDA

View Full Version : Solved: Combo Box on form to select queries



ek378996
11-30-2010, 11:59 AM
Hello Everyone :hi:,

I am new here and working on a school project that I am having trouble with. I want to have a combo box that allows the user to select a certain query to run, in which, 2 other combo boxes below it will have the information needed for the query. The options in the second 2 boxes do not have to update with the query selection, as all the queries use the same information. But I can't figure it out :dunno.

Here is my coding so far:


Option Compare Database
Public stQuery As String
Option Explicit




Public Sub cboSchedule_Click()

Select Case Me.cboSchedule
Case 1
stQuery = "MonFri From Philly Query"
Case 2
stQuery = "MonFri To Philly Query"
Case 3
stQuery = "Sat From Philly Query"
Case 4
stQuery = "Sat To Philly Query"
Case 5
stQuery = "Sun From Philly Query"
Case 6
stQuery = "Sun To Philly Query"
End Select



End Sub

Public Sub cmdSearch_Click()

Dim stDocName As String

stDocName = stQuery
DoCmd.OpenQuery stDocName, acNormal, acEdit
Me.lstResults.RowSource = stQuery
End Sub