J
Justin83716
I have created a Search form that uses combo boxes to select the various
search criteria. The form has a subform that creates a filter based on the
selections made via the combo boxes.
My problem is only one of the selection criteria works, the second criteria
brings up an Enter parameter box that requires me to re-enter the selection a
second time. If I re-enter the data and select OK, nothing happens. If I
simply press cancel it takes me to debugger. The highlighted portion it shows
me is pointed out below. The code is identical for both controls, except one
works and the other doesn't. Can anyone point me to where the problem could
be.
Here is a link to the code that I based my idea on. (Specifically the Search
Issues form)
http://office.microsoft.com/en-us/templates/TC012186931033.aspx?CategoryID=CT101426031033
Here is my code as I tried to adapt it.
Private Sub cmdSearch_Click()
Dim strWhere As String
‘DimstrError As String
strWhere = "1=1"
'If Employee Number
If Nz(Me.cboEmployeeNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Emp #] = " &
Me.cboEmployeeNumber & ""
End If
'If Project Number
If Nz(Me.cboProjectNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Proj #] = " &
Me.cboProjectNumber & ""
End If
If StrError <> "" Then
MsgBox StrError
Else
'DoCmd.OpenForm "fsubRecordSearch", acFormsDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.fsubRecordSearch.Form.Filter = strWhere
Me.fsubRecordSearch.Form.FilterOn = True **DEBUG HIGHLIGHTS THIS**
End If
End Sub
Thanks in advance to whatever brave soul attempts to help me with this!
search criteria. The form has a subform that creates a filter based on the
selections made via the combo boxes.
My problem is only one of the selection criteria works, the second criteria
brings up an Enter parameter box that requires me to re-enter the selection a
second time. If I re-enter the data and select OK, nothing happens. If I
simply press cancel it takes me to debugger. The highlighted portion it shows
me is pointed out below. The code is identical for both controls, except one
works and the other doesn't. Can anyone point me to where the problem could
be.
Here is a link to the code that I based my idea on. (Specifically the Search
Issues form)
http://office.microsoft.com/en-us/templates/TC012186931033.aspx?CategoryID=CT101426031033
Here is my code as I tried to adapt it.
Private Sub cmdSearch_Click()
Dim strWhere As String
‘DimstrError As String
strWhere = "1=1"
'If Employee Number
If Nz(Me.cboEmployeeNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Emp #] = " &
Me.cboEmployeeNumber & ""
End If
'If Project Number
If Nz(Me.cboProjectNumber) <> "" Then
'Create Predicate
strWhere = strWhere & " AND " & "tblEmployeeProjectDetails.[Proj #] = " &
Me.cboProjectNumber & ""
End If
If StrError <> "" Then
MsgBox StrError
Else
'DoCmd.OpenForm "fsubRecordSearch", acFormsDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.fsubRecordSearch.Form.Filter = strWhere
Me.fsubRecordSearch.Form.FilterOn = True **DEBUG HIGHLIGHTS THIS**
End If
End Sub
Thanks in advance to whatever brave soul attempts to help me with this!