|
-
Oct 10th, 2001, 02:04 PM
#1
Thread Starter
Addicted Member
Access CreateField
I am using CreateField to add a Date field to an existing table in Access. When I execute the code, everything seems fine but in reality, the field is not created.
Why is that?
Note: The name of the table is valid and I have checked to see if access finds it.
here's my code:
Code:
Public Sub DoTableUpdate()
Dim dbs As Database
Set dbs = OpenDatabase("C:\Documents and Settings\dlaplante\Desktop\Syndata\Database\SynagisData.mdb")
dbs.TableDefs("Shipment").CreateField "Shipment_NextDate", dbDate
dbs.Close
Set dbs = Nothing
End Sub
-
Oct 10th, 2001, 02:10 PM
#2
-= B u g S l a y e r =-
I think u have to Append the field.
-
Oct 10th, 2001, 02:14 PM
#3
-= B u g S l a y e r =-
try doing it this way :
VB Code:
Public Sub DoTableUpdate()
Dim dbs As Database
Dim f As Field
Set dbs = OpenDatabase("C:\Documents and Settings\dlaplante\Desktop\Syndata\Database\SynagisData.mdb")
Set f = dbs.TableDefs("Shipment").CreateField("Shipment_NextDate", dbDate)
dbs.TableDefs("Shipment").Fields.Append f
dbs.Close
Set dbs = Nothing
End Sub
-
Oct 10th, 2001, 02:15 PM
#4
Thread Starter
Addicted Member
Bullseye!
-
Oct 10th, 2001, 02:16 PM
#5
-= B u g S l a y e r =-
your welcome David
-
Oct 10th, 2001, 02:26 PM
#6
Thread Starter
Addicted Member
Nice icon you have there by the way!
-
Oct 10th, 2001, 02:39 PM
#7
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|