N
NielsE
I have a form where users can enter three variables using three combo boxes
and the resulting records are shown in list box on the form. It works fine.
However, i would like
to be able to choose "All" in one, two or all three combos. It is not a
problem for me to add the "All" in each combo.
The general declarations for the form are:
Option Compare Database
Option Explicit
Private Const strSQL1 = "SELECT ProjectID, Projectsymbol, Title, StatusDate,
Budget " & _
"FROM qryParam3 WHERE Region = '"
Private Const strSQL2 = "' AND Status = '"
Private Const strSQL3 = "' AND SubjectName = '"
Private Const strSQL4 = "' Order BY StatusDate DESC;"
Private strSQL As String
The FillList code is:
rivate Sub FillList()
strSQL = strSQL1 & Me!cboRegion.Value & _
strSQL2 & Me!cboStatus.Value = "" & strSQL3 & Me!cboSubject.Value &
strSQL4
Me!lstProjects.RowSource = strSQL
Me!lstProjects.Requery
Me!lbllist.Caption = "Projects from " & _
Me!cboRegion.Value & " that are " & _
Me!cboStatus.Value & " and where the subject is " & _
Me!cboSubject.Value
If Me!lstProjects.ListCount = 0 Then
Me!lbllist.Caption = "No " & Me!lbllist.Caption
Me!lblLineProjects.Caption = strMsg4
End If
End Sub
An example for for the AfterUpdate for one of the combos is:
Private Sub cboRegion_AfterUpdate()
If Me!cboStatus.Value <> "" Then
Call FillList
Else
Me!lbllist.Caption = strMsg1
End If
With Me!lstLineProjects
.RowSource = ""
.Requery
End With
Me!lblLineProjects.Caption = strMsg5
End Sub
What do I have to change to get an "All" choice in one,two or three combos
to work?
Thanks in advance.
Niels
and the resulting records are shown in list box on the form. It works fine.
However, i would like
to be able to choose "All" in one, two or all three combos. It is not a
problem for me to add the "All" in each combo.
The general declarations for the form are:
Option Compare Database
Option Explicit
Private Const strSQL1 = "SELECT ProjectID, Projectsymbol, Title, StatusDate,
Budget " & _
"FROM qryParam3 WHERE Region = '"
Private Const strSQL2 = "' AND Status = '"
Private Const strSQL3 = "' AND SubjectName = '"
Private Const strSQL4 = "' Order BY StatusDate DESC;"
Private strSQL As String
The FillList code is:
rivate Sub FillList()
strSQL = strSQL1 & Me!cboRegion.Value & _
strSQL2 & Me!cboStatus.Value = "" & strSQL3 & Me!cboSubject.Value &
strSQL4
Me!lstProjects.RowSource = strSQL
Me!lstProjects.Requery
Me!lbllist.Caption = "Projects from " & _
Me!cboRegion.Value & " that are " & _
Me!cboStatus.Value & " and where the subject is " & _
Me!cboSubject.Value
If Me!lstProjects.ListCount = 0 Then
Me!lbllist.Caption = "No " & Me!lbllist.Caption
Me!lblLineProjects.Caption = strMsg4
End If
End Sub
An example for for the AfterUpdate for one of the combos is:
Private Sub cboRegion_AfterUpdate()
If Me!cboStatus.Value <> "" Then
Call FillList
Else
Me!lbllist.Caption = strMsg1
End If
With Me!lstLineProjects
.RowSource = ""
.Requery
End With
Me!lblLineProjects.Caption = strMsg5
End Sub
What do I have to change to get an "All" choice in one,two or three combos
to work?
Thanks in advance.
Niels