Re: Lookup form
- From: "Tony Williams" <tw@xxxxxxxxxxx>
- Date: Wed, 24 May 2006 09:20:28 +0100
Success!!!!!!! I realised that as my "keyfield" wasn't a string I didn't
need to use the ' an "'" in the Where and it worked!!!!!
Thanks so much for guiding me down the right path. I owe you one!!!
Cheers
Tony
"Ofer Cohen" <OferCohen@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:8F82CC04-4D51-4389-90F2-B6931F5A5C32@xxxxxxxxxxxxxxxx
The RowSource of the list box is a kind of query, you can use few tables,
display few fields, and apply filter to more then one field, just as you
do
with a normal query.
Try it, play with the idea and if you'll get a spacific problem , I'll be
more then happy to try and help you.
--
Good Luck
BS"D
"Tony Williams" wrote:
I've spoken to the person who is going to use this database and what they
have now asked for is can the search form have one text box which they
enter
text (with a wildcard) and that searches 3 fields one from each of three
tables. Eg the text input in the text box should look for the string in
table1.field1, table2.field2 and table3.field3 The three fields are all
text
strings ie names. the content of the list box would display all the
results
from the three tables. So presumably could the record source of the list
box
be a query created from the three joined tables, they all have a field
that
connects them called txtrefnbr.
The root of this database is one table which holds details of a contract,
the contract can have 1, 2 or 3 parties, the other three tables are
details
of the three separate parties to the contract linked on the txtrefnbr.
I thought they would be happy with what you did the first time but show
someone something and they want more! Ah well that's life
Is this getting too complicated?
Thanks, really appreciate you sticking with me
Tony
"Ofer Cohen" <OferCohen@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:325A8306-E243-4276-9D99-5B4D1D271834@xxxxxxxxxxxxxxxx
Mybe there is a confusion here,
The Where condition used to open the second form.
The Select se to filter the list box, I thought you want to filter the
list
box with more then one option, and this is why I gave the select
example.
Do you want to add more fields to the filter when you open the second
form?
--
Good Luck
BS"D
"Tony Williams" wrote:
Sorry to be so naive but does the SELECT statement replace the
MyWhereCondition in the OnDoubleClick?
Thanks
Tony
"Ofer Cohen" <OferCohen@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:330DCF31-91A3-43FA-8892-1BCC8E9F5575@xxxxxxxxxxxxxxxx
You don't have to, you can use only one text box, but it can be
confusing
for
the user to use, they might think that you get the wrong resault if
they
want
to search by the name only
--
Good Luck
BS"D
"Tony Williams" wrote:
Sorry just checking, does this mean my search form needs a separate
text
box
for each field I'm searching on as you have indicated two
textboxnames?
Thanks
"Ofer Cohen" <OferCohen@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A9A3E55E-FB14-4196-B56C-B186ED1EE10E@xxxxxxxxxxxxxxxx
You can use more then one field for the search
Select Field1, Field2, Filed3 From TableName Where SurName Like
Forms![FormName]![TextBoxName] & "* And CompanyName Like
Forms![FormName]![companyTextBoxName] & "*"
--
Good Luck
BS"D
"Tony Williams" wrote:
That worked absolutely great!!!
Now can I get even cleverer? Can I have more than one text box
to
search.
EG
at the moment the text box searches for Surname, what if the
user
didn't
know the surname and wanted to search on say the company name or
a
reference
number so they had three possible search criteria. Is this
possible
or
would
it work with an Option Group?
Really pleased with the result so far thanks a lot
Tony
"Ofer Cohen" <OferCohen@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message
news:AAE55EAD-DA20-493E-B725-F870E999C481@xxxxxxxxxxxxxxxx
Mybe instead of a sub form you can use a list box
1. Create a new form, in it create a Text box to enter the
surname,
and
a
list box to display the resault.
2. The Row source of the list box will include a filter to
text
box
created.
Select Field1, Field2, Filed3 From TableName Where SurName
Like
Forms![FormName]![TextBoxName] & "*"
3. On the after update event of text box you need to reresh
the
list
box,
so
enter the code in that event
Me.[ListBoxName].Requery
4. On the DblClick event of the ListBox you can write the code
that
open
another form with the full details using the WhereCondition of
the
open
form
command line
Dim MyWhereCondition as String
MyWhereCondition = "[KeyField] = " & Me.[ListBoxName]
Docmd.OpenForm "FormName" , , , MyWhereCondition
=========================
If the key field is string use
MyWhereCondition = "[KeyField] = '" & Me.[ListBoxName] & "'"
=========================
If the key field is not the first column in the list box then
you
need
to
specify hat column number that start with 0
MyWhereCondition = "[KeyField] = " &
Me.[ListBoxName].Column(1)
=========================
I hope it's clear enough, I'll be happy to help you more if
you
need
me
to.
--
Good Luck
BS"D
"Tony Williams" wrote:
I want to create a lookup form which works like this
1.There is a textbox which will accept a wildcard input eg
sm*
to
catch
names like smith, small etc based on txtsurname a field in my
table
tbltcp
2.On clicking a command button the results are shown in a
data***
display
on the form
3.On clicking on one of the results it opens another form
which
shows
the
whole record.
I've seen examples of this I am sure but I wondered if
someone
could
get
me
started on the basics so that I could have a go myself at
building
such a
form.
I'm a novice at coding so please simple instructions would be
appreciated
Thanks
Tony
.
- References:
- Lookup form
- From: Tony Williams
- Re: Lookup form
- From: Tony Williams
- Re: Lookup form
- From: Ofer Cohen
- Re: Lookup form
- From: Tony Williams
- Re: Lookup form
- From: Ofer Cohen
- Re: Lookup form
- From: Tony Williams
- Re: Lookup form
- From: Ofer Cohen
- Re: Lookup form
- From: Tony Williams
- Re: Lookup form
- From: Ofer Cohen
- Lookup form
- Prev by Date: Re: Lookup form
- Next by Date: List box question
- Previous by thread: Re: Lookup form
- Next by thread: =??Q?Display_QBF_Results_in_a_Form=3F?=
- Index(es):