Got a runtime Problem

Jennings

New member
Local time
Today, 12:19
Joined
Nov 10, 2007
Messages
1
This module works in access 2003 but fails in the runtime version. How can I change it to work with the runtime?


Function AddColumn1()

Dim strConnect As String
Dim strTableName As String
Dim strFieldName As String
Dim db As DAO.Database
Dim tDef As DAO.TableDef

strConnect = CurrentProject.Path
strTableName = "Inventory_Brass"
strFieldName = "QRemaining"

Set db = OpenDatabase(strConnect & "\IData.mdb")
Set tDef = db.TableDefs(strTableName)
With tDef
.Fields.Append .CreateField(strFieldName, [dbLong])
End With

Set tDef = Nothing
Set db = Nothing

End Function
 
Welcome to Access World Forums.

I'm going to ask why you would need to add a column (which of course is a design change and the runtime can't do design changes).

Adding a column in this way makes me question if the database is properly normalized. If it is properly normalized you should not need to add a column. That being said, maybe you have a good reason to want to. I don't think you'll really be successful at it with the runtime because as I said before the runtime version can't make design changes.
 

Users who are viewing this thread

Back
Top Bottom