RE: how to search two fields in form
- From: bbypookins <bbypookins@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 16 Apr 2008 15:21:00 -0700
I think your idea sounds good and would probably want to use a command
button. It seems to me that would be easier for the user...and that is the
most important thing.
"Beetle" wrote:
Sorry for the confusion. I know you've been trying to figure this out for.
some time, so I'll try to clarify why I think a combo box *might* not
be the best option in this case (I say might, because there is always the
possibility that I'm wrong, wouldn't be the first time).
A combo box has a row source property, which determines the values that
are displayed in the combo box. The row source can be either a value list
that you define, or a query that pulls values from a table. In your case it
would
be a query that pulls the existing division and sequence numbers from your
table.
So let's say you create a combo box with a row source query that shows
the division and sequence numbers in two separate columns. In it's
unexpanded state, your combo box will only show the division (the first
visible column). That's probably no big deal, but your users would also
not be able to type a sequence number into the combo box. They could
type a division to narrow the results, but then they would still have to
click the row with the appropriate sequence number from the remaining
choices.
So if your users are always going to know both values it might be a little
easier just to have two unbound text boxes where they could enter the
division and sequence number, and then have your code run the search.
You could have a command button that they could click or you could just
run the code in the after update event of one of the text boxes.
If you have a preference of one method over the other, post back and
we can try to get it working for you.
--
_________
Sean Bailey
"bbypookins" wrote:
I think I"m still confused. But, they will always know what combination they
will be searching for.
"Beetle" wrote:
The code Dave provided should fire whenever you select a value in the combo
box. You shouldn't have to do anything else for the search to run. However,
before trying to solve your combo box issues, I read some of your previous
posts and have a question.
Will you users always know in advance the division and sequence number
they want to search for? (in which case it may be easier to use two unbound
text boxes and a command button)
Or do you want to present them with a list to choose from? (in which case the
combo box method would be better)
--
_________
Sean Bailey
"bbypookins" wrote:
I need my users to be able to search a form for a combination of two fields.
The fields are "Division" and "SeqNumber". Below is the instruction and code
Dave Hargis gave me, but I don't understand how to search once it is in
there. The only way I know how to search a form is to do a ctrl+F , indicate
select the field you want to search and type in what you want to find. How
would this new field work? I'm confused.
From Dave:
Now, in your case, you need to find the division and the sequence number.
You will need to search using both of those values.
Let's call it cboFindRecord
Private Sub cboFindRecord_AfterUpdate
With Me.RecorsetClone
.FindFirst "[SeqNumber] = " & Me.SeqNumber & " AND [Division] = '" &
Me.Division & "'"
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
End Sub
- References:
- how to search two fields in form
- From: bbypookins
- RE: how to search two fields in form
- From: Beetle
- RE: how to search two fields in form
- From: bbypookins
- RE: how to search two fields in form
- From: Beetle
- how to search two fields in form
- Prev by Date: RE: how to search two fields in form
- Next by Date: assign code to a button
- Previous by thread: RE: how to search two fields in form
- Next by thread: Need Help Building...
- Index(es):
Relevant Pages
|