|
-
May 14th, 2000, 04:12 PM
#1
Thread Starter
Hyperactive Member
Hello The_Inspector,
Please show your source whith the error.
Michelle.
-
May 15th, 2000, 02:26 AM
#2
Junior Member
Private Function CreateDB()
Const DB_LANG_GENERAL = ";LANGID=0x0809;CP=1252;COUNTRY=0"
Dim DB As Database
Dim tdData As New TableDef
Dim tdGrades As New TableDef
Dim fFirstName As New Field
Dim fLastName As New Field
Dim fOld As New Field
tdData.Name = "Data"
tdGrades.Name = "Grades"
fFirstName.Name = "FirstName"
fFirstName.Type = 10
fFirstName.Size = 15
fFirstName.Required = True
fLastName.Name = "LastName"
fLastName.Type = 10
fLastName.Size = 25
fLastName.Required = True
fOld.Name = "Old"
fOld.Type = 1
fOld.Required = True
tdData.Fields.Append fOld
tdData.Fields.Append fLastName
tdData.Fields.Append fFirstName
tdGrades.Fields.Append fFirstName <-- Here I get the error
tdGrades.Fields.Append fLastName
.
.
.
-
May 15th, 2000, 02:01 PM
#3
Thread Starter
Hyperactive Member
Hello The_Inspector,
I studied your source. At the moment you are appending a field definition to a table, it is linked to that table and it is not possible to use the same field definition a second time.
for example:
Set DB = CreateDatabase(DBset, dbLangGeneral)
tdData.Fields.Append fOld
tdData.Fields.Append fLastName
tdData.Fields.Append fFirstName
DB.TableDefs.Append tdData
DB.Close 'X)
Set DB = OpenDatabase(DBset)
tdGrades.Fields.Append fFirstName 'X)
tdGrades.Fields.Append fLastName
DB.TableDefs.Append tdData
X) After closing the DB, the information in field definition fFirstName & fLastName & tdData is lost.
Thanks to uncle Bill G.
Sorry that I can't help you, but you have to create your field definitions twice! (maybe not in VB6)
Nice regards,
Michelle.
-
May 15th, 2000, 02:51 PM
#4
Junior Member
Welp, if there isn't another way then I guess the best thing to do is either make a loop or a function that resets the fields' information...
10x for your help
-
May 19th, 2000, 09:34 PM
#5
Thread Starter
Hyperactive Member
Hello The_Inspector,
Maybe this helps:
DB.Execute ("select * into Newtable from ExistingTable")
This SQL command makes a copy of a table (with contents) to another table.
Nice regards,
Michelle.
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
|