Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / February 2006

Tip: Looking for answers? Try searching our database.

Creating table from Word VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bo Hansson - 12 Feb 2006 21:52 GMT
Using CreateField Method(DAO) I want to create new Acess tables from Word
VBA code, see following example

Set dbsDB = OpenDatabase(myDataBase)
Set tdf = dbsDB.CreateTableDef(myTable)
With tdf
     tdf.Fields.Append .CreateField("Name", dbText, 50)
    ...and so on

This works fine, but how do I create a field containing a counter ?

/BosseH
Douglas J. Steele - 12 Feb 2006 22:29 GMT
You mean you want an Autonumber field?

Dim dbsDB As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field

Set dbsDB = OpenDatabase(myDataBase)
Set tdf = dbsDB.CreateTableDef(myTable)
With tdf
     tdf.Fields.Append .CreateField("Name", dbText, 50)
     Set fld = .CreateField("Id", dbLong)
     fld.Attributes = fld.Attributes + dbAutoIncrField
    .Fields.Append fld
...and so on

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

> Using CreateField Method(DAO) I want to create new Acess tables from Word
> VBA code, see following example
[quoted text clipped - 8 lines]
>
> /BosseH
Bo Hansson - 13 Feb 2006 01:36 GMT
Thanks a lot!

/BosseH
> You mean you want an Autonumber field?
>
[quoted text clipped - 23 lines]
>>
>> /BosseH
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.