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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Appends in One Query

Status
Not open for further replies.

DirtyB

Programmer
Mar 13, 2001
159
US
I have 25 tables that are identical in structure. I need a query that can add the same field with different data to all of them.

More specifically, each table represents demographic information of thousands of students. I need to put all of this data together into one table, that part is done, but I need to know what school they came from, and the tables do not contain that information. I would do it manually, but these tables are recreated every day.

Ideally, I need to write a query that can append one field to each table, and populate it with the corresponding school ID number. There are too many fields to give specific structure, but if someone could just give me an example of how to append a field to multiple tables and set each field = to a fixed number per table that would be great.

Thanks
 
I couldn't figure out how to do this from a query, so I looked into doing it with a module. Anyway, I found an old post from GZEP that gave some quick and easy code for adding fields. Anyway, my question is answered, but I thought i'd repost his code in case anyone else needs to know how to do this.

Thanks everyone.

CurrentDb.TableDefs("A").Fields.Append CurrentDb.TableDefs("A").CreateField("Fred", dbLong)

CurrentDb.TableDefs.Refresh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top