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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Append.CreateField

Status
Not open for further replies.

billheath

Technical User
Mar 17, 2000
299
US
I am trying to automate the adding of a new field to an existing Table ("Stk_tbl_tbl").

I have written the following code:
Private Sub New_Acct_Click()

Dim dbs As DAO.Database
Dim tdfStk_Rec_tbl As DAO.TableDef


Set tdfStk_Rec_tbl = dbs.TableDefs("Stk_Rec_tbl")

With tdfStk_Rec_tbl
.Fields.Append .CreateField("Symbol", dbText, 10)


End With
' Set rstStkSub = Nothing
End Sub

Everytime I try to run the code, I get the error "Object Variable or with block veriable not set" on the "Set tdfStk_REc_tbl" line.

I am not sure what is wrong. I copied the procedure from the Access help files.
Thanks for your help!!!
Bill
 
Sorry, Duane. Actually I did. I'm not sure why it didn't show.
However, I found the problem. I was trying to run the procedure with the table open1
Thanks for you help.


 
Just curious -- wh ydo you have to add field to an existing table programatically?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top