RE: how to search two fields in form

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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






.



Relevant Pages

  • RE: how to search two fields in form
    ... Sorry for the confusion. ... The row source can be either a value list ... the division and sequence numbers in two separate columns. ... run the code in the after update event of one of the text boxes. ...
    (microsoft.public.access.gettingstarted)
  • new vs existing record to be entered / edited
    ... I have a form that opens with this command: ... on the form are 2 combo boxes ... the first is for a manufacturer's name, and has a row source of a table ... already entered catalogue numbers (for the manufacturer entered; ...
    (microsoft.public.access.formscoding)
  • RE: List, Combo, or something else
    ... order is to use the primary key which may not be the sequence you want. ... for the combo you use a row source type of Table/Query and you use the ... Because Column 1 is the bound column, ... data entry form will have a field ...
    (microsoft.public.access.forms)
  • Re: Migration tool
    ... database schema for a web application I'm developing. ... contain the SQL code to generate the objects (tables, sequences, ... new column and a drop column command to eliminate one no longer ... present it will not know the actual sequence of events was to add the ...
    (comp.databases.oracle.tools)
  • [2.6 patch] drivers/char/ip2*: misc cleanups (fwd)
    ... -// This routine sets the parameters of command 38 Define Hot Key sequence (alias ... -i2cmdSetSeq(unsigned char type, unsigned char size, unsigned char *string) ... +static inline int ...
    (Linux-Kernel)