Rename a Back End Table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a Front and back end Database and need to rename a table in the back
and a field within that table. I do this as follows:

Dim dbsUpdate As Database, wrkDefault As Workspace
Dim tdfUpdate As TableDef

Set wrkDefault = DBEngine.Workspaces(0)

Set dbsUpdate = wrkDefault.OpenDatabase(strBackEnd, True, False, "MS
Access;")
dbsUpdate.TableDefs("tbltemptable1").Name = "tblControl"
dbsUpdate.TableDefs("tblControl").Fields("Field1").Name = "PatchVersion"

My question is how do I then rename the table in the front-end without
breaking the link?

Many thanks.
 
When you rename the table in the back end, you've already broken the link.

Your best bet, after renaming the table in the back end, is to delete the
link in the front end and then use transferdatabase to re-link the table,
using the new table name as the source and any name you like for the link
name.

Check out "DoCmd.TransferDatabase acLink"
 
When you rename the table in the back end, you've already broken the link.

Your best bet, after renaming the table in the back end, is to delete the
link in the front end and then use transferdatabase to re-link the table,
using the new table name as the source and any name you like for the link
name.

Check out "DoCmd.TransferDatabase acLink"
 
thanks for the reply, I decided in the end it was easier to create a new
table in both and set the source for the front end to the table in the back
end.
 
thanks for the reply, I decided in the end it was easier to create a new
table in both and set the source for the front end to the table in the back
end.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top