G
Guest
I have a form with one combo box which allows the user to select a project
number. When they click on okay it opens up a detail screen in single form
mode that lets them scroll through records related to the project they chose.
It works great. Then I have a project summary Continuous Form that displays
the status of different parts of the project. I created a form with 3 combo
boxes to select different viewing options. However, this form doesn't work
at all. I need it to open the summary form displaying only the records
related to the options they chose. I am sure the problem is with my criteria
in the WHERE portion of the DoCmd.OpenForm method. Also, if the user does
not select one of the values, then I would like the form to ignore that
criteria when opening the form so as to NOT limit the records relating to the
other criteria. Here is my code. Thanks:
Private Sub cmdOk_Click()
Dim strProject As String
Dim strStatus As String
Dim strPass As String
' to avoid error on assigning null values
If IsNull(Me.cmbProject) Then
strProject = ""
Else
strProject = Me.cmbProject
End If
If IsNull(Me.cmbStatus) Then
strStatus = ""
Else
strStatus = Me.cmbStatus
End If
If IsNull(Me.cmbPass) Then
strPass = ""
Else
strPass = Me.cmbPass
End If
DoCmd.OpenForm "frmVolumeSummary", , , "Project = '" & strProject & "'" & _
"VolumeStatus = '" & strStatus & "'" & "PassStatus = '" & strPass & "'"
DoCmd.Close acForm, Me.Name
End Sub
number. When they click on okay it opens up a detail screen in single form
mode that lets them scroll through records related to the project they chose.
It works great. Then I have a project summary Continuous Form that displays
the status of different parts of the project. I created a form with 3 combo
boxes to select different viewing options. However, this form doesn't work
at all. I need it to open the summary form displaying only the records
related to the options they chose. I am sure the problem is with my criteria
in the WHERE portion of the DoCmd.OpenForm method. Also, if the user does
not select one of the values, then I would like the form to ignore that
criteria when opening the form so as to NOT limit the records relating to the
other criteria. Here is my code. Thanks:
Private Sub cmdOk_Click()
Dim strProject As String
Dim strStatus As String
Dim strPass As String
' to avoid error on assigning null values
If IsNull(Me.cmbProject) Then
strProject = ""
Else
strProject = Me.cmbProject
End If
If IsNull(Me.cmbStatus) Then
strStatus = ""
Else
strStatus = Me.cmbStatus
End If
If IsNull(Me.cmbPass) Then
strPass = ""
Else
strPass = Me.cmbPass
End If
DoCmd.OpenForm "frmVolumeSummary", , , "Project = '" & strProject & "'" & _
"VolumeStatus = '" & strStatus & "'" & "PassStatus = '" & strPass & "'"
DoCmd.Close acForm, Me.Name
End Sub