Rx_
Nothing In Moderation
- Local time
- Today, 06:24
- Joined
- Oct 22, 2009
- Messages
- 2,803
fields.append method - can code add fields while table records are linked or in use by users?
Will this code add a field while the Table is in use (bound) by the users?
The database has a Customers table - Every user has a link to it when the database is open. As a front-end/ back end split database, there are a half dozen users constantlly linked and engaging this table.
Try and open the table in Design Mode - produces a warning:
"Either an object bound to table ... " Yes for Read Only
Can't use the Access interface tool to open in Design Mode for a read-only view.
There are half a dozen users connected to this table. Will this code allow me to modify the table and add a new field while the table is in use?
There does not appear to be any error trapping code for the examples out there.
Will this code add a field while the Table is in use (bound) by the users?
The database has a Customers table - Every user has a link to it when the database is open. As a front-end/ back end split database, there are a half dozen users constantlly linked and engaging this table.
Try and open the table in Design Mode - produces a warning:
"Either an object bound to table ... " Yes for Read Only
Can't use the Access interface tool to open in Design Mode for a read-only view.
There are half a dozen users connected to this table. Will this code allow me to modify the table and add a new field while the table is in use?
There does not appear to be any error trapping code for the examples out there.
Code:
Function ModifyTableDAO()
'Purpose: How to add fields to existing tables.
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
'Initialize
Set db = CurrentDb()
Set tdf = db.TableDefs("tblDaoContractor") ' table already exist
'Add a field to the table.
tdf.Fields.Append tdf.CreateField("TestField", dbText, 80)
Debug.Print "Field added."
'Destroy object variables
Set fld = Nothing
Set tdf = Nothing
Set db = Nothing
End Function