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
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