By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,476 Members | 1,390 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,476 IT Pros & Developers. It's quick & easy.

SQL Query?

P: n/a
Dear all,

I have a contacts table (table1) detailing
ID
First Name
Last Name

I have another table (table2) with a combo detailing the ID, First
Name and Last Name
i.e.
SELECT table1.ID, table1.[First Name], table1.[Last Name] FROM table1
ORDER BY table1.[Last Name];

When the person is selected in that combo I want the the First Name
and Last Names to be automatically updated in table2 with those
details.

I wrote the SQL statement below but it doesn't work, grateful for any
help.
Cheers,
Leee

SELECT table1.[First Name]
FROM Main
WHERE table2.[ID] = table1.[ID]
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I think you are laboring under a variety of misconceptions here.
1. Comboboxes in general should not be used directly in the tables.
They work great on forms, but if you use one directly in a table, you
are asking for a lot of trouble, because then you can never see what the
actual entry in the table is.

2. It also sounds as if you are working with your data directly in the
tables, which is also rarely a good idea.
That's what forms are for.

3. A SELECT statement will never change the actual value in a table.
UPDATE statements do that.

4. Unless you are working with name changes - i.e. you expect the name
for any given ID to change, you shouldn't be storing the data redundantly -
in two different tables.
Store the names in table1, then use a query to display them together with
the data from table2.
Base your form on that query.

HTH
- Turtle

"Leee" <le********@earthlink.net> wrote in message
news:ck********************************@4ax.com...
Dear all,

I have a contacts table (table1) detailing
ID
First Name
Last Name

I have another table (table2) with a combo detailing the ID, First
Name and Last Name
i.e.
SELECT table1.ID, table1.[First Name], table1.[Last Name] FROM table1
ORDER BY table1.[Last Name];

When the person is selected in that combo I want the the First Name
and Last Names to be automatically updated in table2 with those
details.

I wrote the SQL statement below but it doesn't work, grateful for any
help.
Cheers,
Leee

SELECT table1.[First Name]
FROM Main
WHERE table2.[ID] = table1.[ID]

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.