Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can fields be append from another table that are null

Status
Not open for further replies.

cous261

Programmer
Mar 6, 2001
7
US
Have two tables that I want to append fields from a null table into master table. Basically trying to insert fields in master table to keep from typing them in everytime. This mdb is already created but there are fields that are left out and needed for queries that are imported in at a later time to extract data from master table and other tables in mdb. Have to type fields in master table for queries to run everytime and I have no control on orginal mdb that is sent to me.
Tried this as append query

INSERT INTO Master ( emprret, emprdisab, emprlife, emprhelth, emprmedi, emprdentl, emprptbsav )
SELECT Appendfields.emprret, Appendfields.emprdisab, Appendfields.emprlife, Appendfields.emprhelth, Appendfields.emprmedi, Appendfields.emprdentl, Appendfields.emprptbsav
FROM Appendfields;

But error unknown field happens everytime. Any suggestions to work aroud this to keep from typing in fields everytime.
 
Well, terminology may be killing you here. In Access, an Append Query adds rows to a table, it does not add new columns. Usually the term field and column mean the same thing.

Adding a column (or field) to a table is a change in the structure of the table. In SQL you would ALTER TABLE myTable ADD newColumn INT, for example.

A column can be defined to allow NULL values. This will result in NULL values in any columns in a new row created by the INSERT statement which does not provide a value for the column. The alternative is NOT NULL which will prevent a row being added without a value for the column. In Access this would be accomplised in the Design view by looking at the Properties of a column.

Bottom line it may be that you need to modify the Master table by adding some columns to it. Or else leave them out of the column list in the SELECT clause if they do not exist in the Master table.

 
Thanks RAC2,

Yep, that's exactly what I was doing. Killing myself with terminology or just plain brain dead. Thanks, now it all makes since and I'll guess I'll just have to keep adding the fields (columns) to the table like I have been doing. Guess it's time to get into VBA like I have been wanting to do. Just to many projects and not enough me. Thanks again RAC2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top