If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Cannot execute data definition statements on linked data sources
I receive the error message in the subject line when I try to run the
following SQL ALTER TABLE tblProgDeliv ADD COLUMN [TechID] NUMBER [LONG INTEGER] TechID would be a foreign key to the Tech table, where it is the primary key, and is used as a FK in existing tables as well. Any suggestions on how to accomplish the above via some form of SQL or code will be gratefully accepted. |
#2
|
|||
|
|||
Cannot execute data definition statements on linked data sources
tblProgDeliv is an attached table in some other file.
You will need to OpenDatabase on that file to modify the table: Dim db As DAO.Database Dim strSql As String strSql = "ALTER TABLE ... Set db = OpenDatabase("C:\MyFolder\MyFile.mdb") db.Execute strSql, dbFailOnError db.Close set db = nothing -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "RWilly" wrote in message ... I receive the error message in the subject line when I try to run the following SQL ALTER TABLE tblProgDeliv ADD COLUMN [TechID] NUMBER [LONG INTEGER] TechID would be a foreign key to the Tech table, where it is the primary key, and is used as a FK in existing tables as well. Any suggestions on how to accomplish the above via some form of SQL or code will be gratefully accepted. |
#3
|
|||
|
|||
Cannot execute data definition statements on linked data sourc
Thanks for the response. I would have mentioned that I was trying to modify a
table in the back-end database, but it only dawned on me what the error message meant about 15 seconds after I posted my question. Couldn't see the forest for the trees. I figured I would need to use an OpenDatabase command. Your code will save me a lot of time. Thanks again. "Allen Browne" wrote: tblProgDeliv is an attached table in some other file. You will need to OpenDatabase on that file to modify the table: Dim db As DAO.Database Dim strSql As String strSql = "ALTER TABLE ... Set db = OpenDatabase("C:\MyFolder\MyFile.mdb") db.Execute strSql, dbFailOnError db.Close set db = nothing -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "RWilly" wrote in message ... I receive the error message in the subject line when I try to run the following SQL ALTER TABLE tblProgDeliv ADD COLUMN [TechID] NUMBER [LONG INTEGER] TechID would be a foreign key to the Tech table, where it is the primary key, and is used as a FK in existing tables as well. Any suggestions on how to accomplish the above via some form of SQL or code will be gratefully accepted. |
Thread Tools | |
Display Modes | |
|
|