General Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Latest topics
» Coca Cola New Ad 2013 Telugu Song Free Download Female Voice
MS-Access. Create a new autonumber field in existing table. EmptyWed Feb 19, 2014 5:43 am by winnisab

» женская гинекология
MS-Access. Create a new autonumber field in existing table. EmptyTue Aug 02, 2011 2:42 pm by Guest

» When the first Whirlpool Duet album was released in December 2001
MS-Access. Create a new autonumber field in existing table. EmptySun Jul 31, 2011 10:46 pm by Guest

» tsunade porn hentai tsunade porn manga
MS-Access. Create a new autonumber field in existing table. EmptySat Jul 30, 2011 7:06 pm by Guest

» How to Find The Best Places to Use Your Metal Detector
MS-Access. Create a new autonumber field in existing table. EmptySat May 28, 2011 5:47 am by BobKing1

» How to play Facebook MyZoo
MS-Access. Create a new autonumber field in existing table. EmptyFri Aug 14, 2009 6:39 am by Dan

» How to create an alternate Microsoft Access switchboard form
MS-Access. Create a new autonumber field in existing table. EmptyFri Aug 14, 2009 6:39 am by Dan

» How to simplify making a Microsoft Access schema.ini based on a table
MS-Access. Create a new autonumber field in existing table. EmptyFri Aug 14, 2009 6:38 am by Dan

» How to Make Do Without a Coffee Filter
MS-Access. Create a new autonumber field in existing table. EmptyFri Aug 14, 2009 6:38 am by Dan

Poll
Statistics
We have 12 registered users
The newest registered user is reagkla

Our users have posted a total of 41 messages in 35 subjects
Who is online?
In total there are 2 users online :: 0 Registered, 0 Hidden and 2 Guests

None

[ View the whole list ]


Most users ever online was 108 on Mon Sep 01, 2008 4:48 pm
Welcome To Random Forum Topics

Wed Aug 27, 2008 7:00 pm by Dan

Please refrain from posting illegal or commonly offensive material.

Comments: 1

RSS feeds


Yahoo! 
MSN 
AOL 
Netvibes 
Bloglines 


Affiliates
free forum
 


TV
Watch TV Online

MS-Access. Create a new autonumber field in existing table.

Go down

MS-Access. Create a new autonumber field in existing table. Empty MS-Access. Create a new autonumber field in existing table.

Post  Dan Sun Aug 24, 2008 1:40 pm

Sub CreateNewAutonumberfield()

Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Dim idx As DAO.Index
Dim rel As DAO.Relation


Set db = CurrentDb
On Error Resume Next
'********************************************

' Create new field ID2 of table Table1
Set tdf = db.TableDefs("T_AdjustCntlRecord")
Set fld = tdf.CreateField("ID2", dbLong)
SetPro fld, "Attributes", dbLong, 17
tdf.Fields.Append fld
SetPro fld, "AllowZeroLength", dbBoolean, False
SetPro fld, "DefaultValue", dbText, ""
SetPro fld, "OrdinalPosition", dbLong, 1
SetPro fld, "Required", dbBoolean, False

' create index ID2 of table Table1
Set tdf = db.TableDefs("T_AdjustCntlRecord")
Set idx = tdf.CreateIndex("ID2")
Set fld = idx.CreateField("ID2")
idx.Fields.Append fld
tdf.Indexes.Append idx


End Sub



Private Sub SetPro(o As Object, s As String, t As DataTypeEnum, v As Variant)
'Set the properties
On Error GoTo Problems
o.Properties(s) = v
Exit Sub
Problems:
If Err = 3270 Then
o.Properties.Append o.CreateProperty(s, t, v)
Resume ProblemsX
End If
On Error GoTo 0
Resume
ProblemsX:
End Sub

Dan
Founder
Founder

Number of posts : 30
Registration date : 2008-08-23

https://generalforum.rpg-board.net

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum