Hi, Alan.
Im just wondering if there is a better way than using Visdata on the
client's pc to go into his mdb to fix his tables.
One could use VB Script, which is free and fairly simple if one knows how to
write queries. For example, the following code saved as the file
AddFKeyToTable.vbs would allow one to double-click the script file and
thereby add a foreign key to the tblProducts table in the C:\Work\MyDB.mdb
database file:
Dim cnxn
Dim sDBPath
sDBPath = "C:\Work\MyDB.mdb"
Set cnxn = CreateObject("ADODB.Connection")
cnxn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
sDBPath & ";Persist Security Info=False"
cnxn.Execute "ALTER TABLE tblProducts " & _
"ADD CONSTRAINT tblSupplierstblProducts_FK " & _
"FOREIGN KEY (SupplierID) REFERENCES tblSuppliers SupID;"
cnxn.Close
Set cnxn = Nothing
If an index or an extra column was needed, then the SQL statement of the
query could easily be changed and the rest of the VB Script would remain the
same. The users don't have to be out of the database, but the script
requires a table lock, so no users can be using the table when it's being
altered by the script.
HTH.
Gunny
See
http://www.QBuilt.com for all your database needs.
See
http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs:
www.DataDevilDog.BlogSpot.com,
www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.