Tuesday, July 31, 2012 12:10 PM
Sorry this is probably a very newbie question. I took a copy of my backend database file so that I could apply my changes that I had been working on. The first copy I had was given to me. I did a copy and a paste into my area. I enabled the database to make mods. I recreated my macro and module onto the new database. When I attempt to run it I get the message that my table is locked when I attempt to append the first new field. My table and or database is not open by anyone but me trying to add some columns.
All of my script had been working (with the help of many of you) on a copy of the database that I had. Below is a piece of the code. It fails when try to append the first field.
Any help is greatly appreciated.
Public Function AddColumns()
Dim dbs As DAO.Database
Dim tdef As DAO.TableDef
Dim newField As DAO.Field
Dim prp As DAO.Property
Dim rsttblArbitration As DAO.Recordset
Set dbs = CurrentDb()
Set tdef = dbs.TableDefs!tblArbitration
Set rst = dbs.OpenRecordset("tblArbitration")
'add new fields and set it's properties
Set newField = tdef.CreateField("File_Destroyed_Date", dbDate)
Tuesday, July 31, 2012 12:38 PM
I think the table is locked because before the append you open an unneeded recordset on the table.
Firstly append the new field and then open the recordset
- Marked As Answer by 99Shash99 Tuesday, July 31, 2012 2:02 PM
Tuesday, July 31, 2012 2:04 PMThank you so much!! an oversight on my part...