Re: searching for names - multiple names per record
- From: "Douglas J. Steele" <NOSPAM_djsteele@xxxxxxxxxxxxxxxxx>
- Date: Tue, 6 Feb 2007 07:47:41 -0500
I always use a query, even if the query doesn't do anything more than return
the table as-is.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"zSplash" <zsplash@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:e6X2P2ZSHHA.3996@xxxxxxxxxxxxxxxxxxxxxxx
So, it's slowly becoming clear! The light at the end of a l-o-o-n-n-n-g
tunnel (probably excruciatingly long for you). Thanks, Doug. You've been
the model of patience.
Now, my next question: In creating forms, is it better design to use
queries or tables? In this case, is it better to use Table1 or a query
based on Table1 when I re-design my form?
TIA
"Douglas J. Steele" <NOSPAM_djsteele@xxxxxxxxxxxxxxxxx> wrote in message
news:uohFCRXSHHA.5100@xxxxxxxxxxxxxxxxxxxxxxx
You don't set the ControlSource property for text boxes to SQLwith
statements.
You set the RecordSource of the form to the query, and set the text box's
ControlSource to the name of a field in that query.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"zSplash" <zsplash@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:eFFmxpWSHHA.3948@xxxxxxxxxxxxxxxxxxxxxxx
Okay. I've done that (and named the qTest). And I've created a form
record'stextboxes. So, for example, to pull up the data about the first
pkID,originator's lastname, I've put the following in the Control Source
property
of the textbox:
SELECT [qTest]![Last] from [qTest] where
[qTest]![nameType]="Originator"
But, when I open the form, that textbox shows an error:
Name#?
What's wrong?
TIA
"Douglas J. Steele" <NOSPAM_djsteele@xxxxxxxxxxxxxxxxx> wrote in
message
news:%23ArYefWSHHA.4672@xxxxxxxxxxxxxxxxxxxxxxx
You join them in a query, linking the ID field in Table1 to the
corresponding ID field in Table2.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"zSplash" <zsplash@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:ehgbaXWSHHA.4464@xxxxxxxxxxxxxxxxxxxxxxx
Thanks for the patience for dealing with such a dense person, Doug.
So, I have Table1 and Table2 (excepting that my Table2 has a new
Now,First, Last, and DOB, in addition to your Table1 data). How do I
now
"connect" Table1 with Table2?
TIA
"Douglas J. Steele" <NOSPAM_djsteele@xxxxxxxxxxxxxxxxx> wrote in
message
news:uoukJyRSHHA.3440@xxxxxxxxxxxxxxxxxxxxxxx
I may have confused you.all
If you've got Table1 and Table2 as I described them, that's
essentially
you need.
I'd suggested an extension of that if you had a Person table:
Id Person
1 Tom Jones
2 Mary Brown
3 John Doe
4 Jill Roe
5 Mary Smith
6 John Brown
Then, instead of Table2 being
Id NameType Person
1 Originator Tom Jones
1 Developer Mary Brown
1 Approver John Doe
2 Originator Mary Brown
2 Developer Jill Roe
2 Approver Mary Smith
3 Originator John Brown
3 Developer John Brown
3 Approver Mary Smith
it would be
Id NameType Person
1 Originator 1
1 Developer 2
1 Approver 3
2 Originator 2
2 Developer 4
2 Approver 5
3 Originator 6
3 Developer 6
3 Approver 5
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"zSplash" <zsplash@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:O7E%23eKPSHHA.4076@xxxxxxxxxxxxxxxxxxxxxxx
Thanks so much, Doug. I have tried to re-do my database to meet
your
suggestions. I have a Table1 and Table 2, as you've outlined.
NamesI
intersectionneed
direction on how to make a third table "that resolves the
haveof
the two tables". I just don't quite get the foreign key deal.
TIA
"Douglas J. Steele" <NOSPAM_djsteele@xxxxxxxxxxxxxxxxx> wrote in
message
news:%23dg0zs4RHHA.3412@xxxxxxxxxxxxxxxxxxxxxxx
Realistically, a primary key is just an index, and any index can
up
to
10 separate fields in it.
Which design are you asking about "do I need a foreign key in
storeactualtable"?
Are you talking about my comment at the end ("Depending on your
requirements, you could have a Person table, so that all you
example?in
Table2
is the PersonId."), or are you talking about Table2 in the
in
Table2 must point to Table1, so yes, it must have a foreign key
you'veit.
table",If
you're using "Names table" to refer to what I called "a Person
then
no: that table wouldn't have a foreign key in it. In essence
combinationthatagot
createmany-to-many relationship between Table1 and the Names table.
You
a
third table that resolves the intersection of the two tables,
and
otherintersection table consists of foreign keys pointing back to the
2
tables.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"zSplash" <zSplash@xxxxxxxxxxxxxxxx> wrote in message
news:eZgvwLxRHHA.2172@xxxxxxxxxxxxxxxxxxxxxxx
Thanks, Doug. I didn't know a primary key could be a
ifof
several fields -- I thought it had to be a number field? And
inuseI
your design, do I need a foreign key in Names table to connect
(somehow)
to the pk in the Projects table?
"Douglas J. Steele" <NOSPAM_djsteele@xxxxxxxxxxxxxxxxx> wrote
Smithtable:message
news:eJaRWcvRHHA.3996@xxxxxxxxxxxxxxxxxxxxxxx
Actually, you need at least one additional field in the
second
the
link back to the first table.
Let's assume you currently have Table1:
Id Desc Originator Developer Approver
1 Project A Tom Jones Mary Brown John Doe
2 Project B Mary Brown Jill Roe Mary
(If3 Project C John Brown John Brown Mary Smith
with Id as the Primary Key.
You'd change Table1 to:
Id Desc
1 Project A
2 Project B
3 Project C
still with Id as the Primary Key.
and Table2 would be:
Id NameType Person
1 Originator Tom Jones
1 Developer Mary Brown
1 Approver John Doe
2 Originator Mary Brown
2 Developer Jill Roe
2 Approver Mary Smith
3 Originator John Brown
3 Developer John Brown
3 Approver Mary Smith
with the combination of Id and NameType as the Primary Key.
canyou
forcan
have more than NameType for a particular item, you'd need
more
messagethe
table,PK)
Depending on your actual requirements, you could have a
Person
so
that all you store in Table2 is the PersonId.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"zSplash" <zNOSPAMSplash@xxxxxxxxxxxxxxxxxxxxxxx> wrote in
table,news:e5fUkLvRHHA.4832@xxxxxxxxxxxxxxxxxxxxxxx
Thanks, Doug, but I just don't get it. If I have a single
awith
col for Nametype, a col for First, and a col for Last, how
onenameeverI
messagehave more than one name per record?
st.
"Douglas J. Steele" <NOSPAM_djsteele@xxxxxxxxxxxxxxxxx>
wrote
in
news:eQ$4lasRHHA.5064@xxxxxxxxxxxxxxxxxxxxxxx
No, I don't think you should have a separate table for each
waswastype.
Have a single name table with an additional column of
NameType.
That'll make queries like "Let me know all records that
John
Brown
is
involved with", "Let me know those records for which Mary
Smith
the
Approver" and "Let me know all records where the same
person
the
Developer and the Originator" much, much simpler.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"zSplash" <zNOSPAMSplash@xxxxxxxxxxxxxxxxxxxxxxx> wrote in
message
news:%23bVu3alRHHA.4188@xxxxxxxxxxxxxxxxxxxxxxx
Thanks, Doug, for responding.
By "create a second table linked to that first table with
andnameType?forrow
each name" that I should have individual tables for each
That is leave the mainTable with the common information,
nameApprover,then
create a table for nameOriginator, a table for
wrotea
table
nameDeveloper, etc, with nameData for each of those
nameTypes?
"Douglas J. Steele" <NOSPAM_djsteele@xxxxxxxxxxxxxxxxx>
youin
message news:up0Yg8kRHHA.3948@xxxxxxxxxxxxxxxxxxxxxxx
You'd better explain your precise need, but in general,
field"Developer"wouldn't
put multiple names on a single record.
Typically when you have multiple names on a single
record,
it
means
you've got field names like "Originator", "Approver",
etc. That's not a good idea: you're hiding data in the
(first/last)fortable,names.
Instead, you should keep the common information in the
one
forand
create a second table linked to that first table with one
row
messageeach name.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"zSplash" <zNOSPAMSplash@xxxxxxxxxxxxxxxxxxxxxxx> wrote
in
news:O9hw1zkRHHA.4744@xxxxxxxxxxxxxxxxxxxxxxx
My database needs to track several names (first and
last)
each
record. My initial database had all the names
ain
forthe
main table. In an earlier request for help re:
searching
lastnames, someone suggested that I put all the names in
onlymodifiedseparate
Names table with a nameType comboBox. Now that I've
my
database to do that, I see that with that design I can
inthenhave
one
name per record. (To enter names, I select nameType, and
enter
onefirst/last names for that nameType. I have no way of
entering/adding the first/lastnames for the other
nameTypes.
Each
record has 5 or 6 first/last names to track. If they are
all
in
Names table, as suggested, I can only hold one nameType
problem?each
record.
Can someone please suggest another way to solve my
TIA
.
- Follow-Ups:
- Re: searching for names - multiple names per record
- From: zSplash
- Re: searching for names - multiple names per record
- References:
- searching for names - multiple names per record
- From: zSplash
- Re: searching for names - multiple names per record
- From: Douglas J. Steele
- Re: searching for names - multiple names per record
- From: zSplash
- Re: searching for names - multiple names per record
- From: Douglas J. Steele
- Re: searching for names - multiple names per record
- From: zSplash
- Re: searching for names - multiple names per record
- From: Douglas J. Steele
- Re: searching for names - multiple names per record
- From: zSplash
- Re: searching for names - multiple names per record
- From: Douglas J. Steele
- Re: searching for names - multiple names per record
- From: zSplash
- Re: searching for names - multiple names per record
- From: Douglas J. Steele
- Re: searching for names - multiple names per record
- From: zSplash
- Re: searching for names - multiple names per record
- From: Douglas J. Steele
- Re: searching for names - multiple names per record
- From: zSplash
- Re: searching for names - multiple names per record
- From: Douglas J. Steele
- Re: searching for names - multiple names per record
- From: zSplash
- searching for names - multiple names per record
- Prev by Date: Re: searching for names - multiple names per record
- Next by Date: Re: searching for names - multiple names per record
- Previous by thread: Re: searching for names - multiple names per record
- Next by thread: Re: searching for names - multiple names per record
- Index(es):
Loading