Multiple Combo Box Selection

  • Thread starter Thread starter Eric
  • Start date Start date
E

Eric

Good Day, I have a form that I want to use for Record selection. I have four
unbound combo boxes that I want the user to select any or all that they know.
As they select 1 - 4, I want some of the information from the record to show
in the bottom part of the form. Also as they continue to narrow down the
records from the query, eventially they have one record remaining. Then I'd
like them to be able to click the a select botton and that record would be
pulled up on another form for edit etc.

I know that the unbound combo boxes need to be referenced to each other as
well as the record information being displayed at the bottom of the form.

I just need some help getting my head around to the overall process.

Thanks
 
I'm not one of the experts but I have a search engine with a button that uses
the following code. It has served me well... you can use unbound text boxes,
list boxes or combos... as long as you name the control and then use it in
the code, you should not have a problem.... here you go:
Private Sub Search_Click()
Const cInvalidDateerror As String = "You have entered an invalid date."
Dim strWhere As String
Dim strError As String

strWhere = "1=1"


'If Customer Number
If Not IsNull(Me.CustNo) Then
'Create Predicate
strWhere = strWhere & " and " & "queSresults.[CC] =" & Me.CustNo & ""
End If

'If Order Number
If Not IsNull(Me.OrderNo) Then
'Add it to the predicate- exact match
strWhere = strWhere & " AND " & "queSResults.Order = '" & Me.OrderNo
& "'"
End If

'If Part Number
If Not IsNull(Me.PartNo) Then
'Add it to the predicate- match on leading characters
strWhere = strWhere & " AND " & "queSResults.PN like '*" & Me.PartNo
& "*'"
End If

'If Customer Name
If Not IsNull(Me.custnm) Then
'Add it to the predicate- match on leading characters
strWhere = strWhere & " AND " & "queSResults.Expr1 like '*" &
Me.custnm & "*'"
End If

'If PO Number
If Not IsNull(Me.PoNo) Then
'Add it to the predicate- match on leading characters
strWhere = strWhere & " AND " & "queSResults.po like '*" & Me.PoNo &
"*'"
End If

' If Opened Date From
If IsDate(Me.Datefrom) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "queSResults.[Date] >= " &
GetDateFilter(Me.Datefrom)
ElseIf Nz(Me.Datefrom) <> "" Then
strError = cInvalidDateerror
End If

' If Opened Date To
If IsDate(Me.Dateto) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "queSResutles[Date] <= " &
GetDateFilter(Me.Dateto)
ElseIf Nz(Me.Dateto) <> "" Then
strError = cInvalidDateerror
End If


If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "frmSearchResults", acFormDS, , strWhere,
acFormEdit, acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If

Me.Results.Form.Filter = strWhere
Me.Results.Form.FilterOn = True
End If


End Sub
 
Back
Top