Easy create new table in Access 2010

lucky245

Registered User.
Local time
Today, 04:32
Joined
Sep 19, 2009
Messages
16
This is probably dead simple, I have always been used to writing vba for Access Xp (haven't done so for a few years) etc where

Dim db as database
Dim rs as recordset

Set db = Currentdb
Set rs = db.CreateTableDef (sorry your correct)

etc
etc

but I cannot seem to do this anymore in 2010.


I am trying to take information from an excel spreadsheet, import into database (can do that manually)

For ease of understanding I have attached an test excel.xls which shows the format of the data before and the resulting code after.


This code is needed to create a table with first column being "Number" and then as many columns as there are unique codes, there may be over 11,000 rows in the input.
(headings will change dependant on input Code names hence the creating new table requirement)

There then needs to be 1 "Number" per row each being unique and the "Result" in the field under its related Code.

I know this could probably done in Excel as well but this is an Access forum.


I only really need help in the code for creating the Table and adding the fields name for each column.

Thanks in advance.
 

Attachments

Last edited:
Are you sure you're not thinking of CreateTableDef?

Alternatively you can use the SQL CREATE TABLE

currentdb.execute("CREATE TABLE table_name (column_name1 data_type, column_name2 data_type, column_name3 data_type, ....)")

Failing that, simply link to the excel file (under the external data tab)
 

Users who are viewing this thread

Back
Top Bottom