Add several fields or columns

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
Starting out with a table (Table1) how may I, using design grid preferably:
(i) add several new fields to Table1 ?
(ii) add the same fields in a new table (Table2) whose records corresponds
to the existing table via IDs?
[Think of Table1 as having people's name, and new fields to be added are
social security and date of birth. ]
Thanks.
David
 
Hi,
Do you mean you wish to add the new fields using SQL as opposed to
opening the table in design view?
You can use the Alter Table statement but you can't do it from the query design grid.
You must choose the SQL view.

Here's an example of adding your date of birth field:

ALTER TABLE Table1 ADD COLUMN DOB DATETIME;

Not sure what data type you want the social security to be.

Also, there is no need to add these fields to another related table.
If your tables are linked by IDs, just use a query to see results from both tables.
 
Hi Dan,
You have answered question 1 of my 2 questions. Thanks.
Could you help figure out question 2 as well?
For question 2, my intent is to place the new fields (DOB, etc) in a new
table.
How may I create this new table (which initially may hold just blanks for
field values - i.e. the data for DOB etc will be copied from some other
sources later.)
In other words, I need to create the new table (as place holders) and be
able to link it by querry to the first table, record by record.
Hope my explanation is not too confusing.

David
 
In other words, I need to create the new table (as place holders) and be
able to link it by querry to the first table, record by record.
Hope my explanation is not too confusing.

If you will be populating the new table with the intent that it
contain data from the old table, you can cut out the intermediate step
by creating a MakeTable query based on your old table.

If you create an empty table there is nothing in its records upon
which you can link!

If for some reason you really need the multistep process, try:

- Copy and paste the table to a new table; choose the "design only"
option. This will create an empty table with all the fields of the old
table.
- Go into design mode and delete fields as needed.
- Run an Append query from the old table into the new table, using
criteria as appropriate to select which records to add.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Back
Top