Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

appending tables code blowing up

Status
Not open for further replies.

DerFarm

Programmer
Mar 10, 2003
25
Access ver 2003 sp2
the variables are properly typed,
the DstDB is actually created just prior to execution

I'm sure the code worked in prior versions, but I can't for the life of me figure out why the append is not working correctly.

Can anyone see something stupendously stupid that I'm doing?

Thanx

Code:
   Conn.Open BuildConnectionString(DstDB)
   Set Cat.ActiveConnection = Conn

   ThisTable.Name = "NearTo"
   ThisTable.ParentCatalog = Cat
   
'first build the column to hold the data
   ThisColumn.Name = srcvar
   ThisColumn.Type = adDouble
   ThisTable.Columns.Append ThisColumn
   ThisTable.Columns.Item(ThisColumn.Name).Properties("Nullable") = adColNullable
   Set ThisColumn = Nothing

'build the autoincrement var
   ThisColumn.Name = "OriginalRank"
   ThisColumn.Type = 3
   ThisTable.Columns.Append ThisColumn
   ThisTable.Columns.Item(ThisColumn.Name).Properties("AutoIncrement") = True
   Set ThisColumn = Nothing
   
   Cat.Tables.Append ThisTable    <<<<<blows up here
   Cat.Tables.Refresh
   Set ThisTable = Nothing



 
The thing works fine when I comment out the properties lines. Leaving the autoincrement line commented out I did the following:

ThisTable.Columns.Item(ThisColumn.Name).Properties("Nullable") = adColNullable

I changed "nullable" to 2 (the 0 based index of the nullable property) and adcolnullable to TRUE. No dice

Then I changed true back to adcolnullable (the appropriate letters went to caps so it IS a valid system constant).
still nothing.

any suggestions?




 
ok, the final answer is that autoincrement is a property, but nullable appears to be an attribute ..... ????

replacing the
.....properties("nullable")=adcolnullable
with
Thiscolumn.attributes=adcolnullable

and the damn thing works fine.

go figure
 
It's a good thing you found it, since the error message "blows up here" doesn't convey any useful information.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top