473,387 Members | 1,638 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Access - create table DAO - but table not found

2
In access .mdb I want to create a new table with 5 fields.
Code is like:
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field

Set db = CurrentDb()
Set tdf = db.CreateTableDef("t_comps2")
With tdf
Debug.Print "Count of fields is: " & tdf.Fields.Count
' create the fields =========
Set fld = .CreateField("compsID", dbLong)
fld.Attributes = dbAutoIncrField + dbFixedField
.Fields.Append fld
Debug.Print "Count of fields is: " & tdf.Fields.Count
'Integer field
.Fields.Append .CreateField("Appr_Num", dbSingle)
.Fields.Append .CreateField("Appr_Item", dbSingle)
'Yes/No field.
.Fields.Append .CreateField("C-s-prnt", dbBoolean)
'Memo field.
.Fields.Append .CreateField("Comps_srcs", dbMemo)
.Fields.Refresh

Debug.Print "Count of fields is: " & tdf.Fields.Count
End With
' Append TableDef object to TableDefs collection of database.
db.TableDefs.Append tdf
MsgBox "Fields have been appended to table.", vbOKOnly
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The message says fields created but I cannot find new table in database window.
Using Access 2000. ... SR-1

Where did my table go?

Thanks in advance.
Jun 17 '10 #1

✓ answered by vb5prgrmr

Are you sure you are looking at the tables window and not queries, forms, or modules? Because I don't see the new table in the module window where I had to go to paste your code... :)



Good Luck

2 1912
vb5prgrmr
305 Expert 100+
Are you sure you are looking at the tables window and not queries, forms, or modules? Because I don't see the new table in the module window where I had to go to paste your code... :)



Good Luck
Jun 18 '10 #2
mver22
2
Code does work as I submitted it. vb5prgrmr is correct about where to look (main access DATABASE window, tables section).

Problem is that new table did not show there until I reopened Access the next time. Neatly confusing!

Thank you. Case closed.
Jun 18 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: mh | last post by:
Hello, I'm trying to create a table from a PHP script. >From what I read in my book about PHP and MySQL I should do something like that: $sql_query="CREATE TABLE '$num' ( 'variable1' ...
1
by: poohnie08 | last post by:
i have a excel spreadsheet showing staff name, date,work hour, ot hour, slot1, slot2, slot3, slot4 and others). The "()" will keep repeating from day 1 until end of month. eg in excel spreadsheet,...
2
by: Alex Boborikin | last post by:
I create a table in MS access: CREATE TABLE TABLE1 (_ID COUNTER PRIMARY KEY, SESSION_ID INTEGER REFERENCES SESSIONS (SESSION_ID), FIELD1 INTEGER, FIELD2 INTEGER, ); session_id is linked to...
3
by: Kathy | last post by:
Hi and thanks in advance for your help! I have Access 2000. I have imported a delinited text file and now have table with one column containing 100 records. I would like to display these values in...
4
by: Ying Lu | last post by:
Hello, I have a table named "USER" under MySQL database. When I am trying to move tables from MySQL to PostgreSQL, I found that I could not create a table namely "USER". I guess "USER" is a key...
0
by: Bogey | last post by:
Hi, I am a complet newby in XML; I just want to create a table for datas coming from XML file <Study StudyNumber="3"> <Sample> <Destination Position="D2"/> <Source SourcePlate="P3"...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
14
by: Lee | last post by:
I have a xml file, here is sample part: <?xml version="1.0" encoding="UTF-8"?> <ProducsList> <Product id="1"> <SpecList> <Spec> <SpecLabel>Height</SpecLabel> <SpecValue>10</SpecValue>...
2
by: nospam | last post by:
Hello, I am using Access 2000 and SQLServer 2000. I have 2 tables - one in Access and one in SS. They are identical in structure. I want to copy the Access or local table ( table_local) to...
1
by: noorulahilah | last post by:
How can i create the table through coding in access? And how can i connect with vb. Suppose "db" is database variable. "stu1" is already existing table name. Now i want to create table "stu2"...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.