Re: Modify Linked SQL table in Acess via VBA code



On Jul 10, 2:51 pm, Bob Bonta <BobBo...@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
I have a SQL backend database which is accessed through an Access front-end
with tables linked with a DSN-less connection.

I need to modify one of the linked tables via code (I don't have direct
access to the SQL database via Enterprise Mgr, etc).  With an Access BE
database, I would enter the following:

    Set db = OpenDatabase("Path & Filename")
    Set tdf = db.TableDefs(strTableName)
    tdf.Fields.Append tdf.CreateField(strNewFieldName, dbText,
intFieldSize)

However, since I can't modify a linked table to a SQL database with the
above method, I am looking for a similiar snippet which will allow me to
directly modify the SQL table, then I could refresh the link to update the
view to the table.

I'm speculating that I can directly access the SQL table utilizing the same
connection string definition as when I link the table to modify the table on
SQL.  

Is this possible?  What would be the syntax for that operation?

--
~ Bob Bonta ~

Create an ADO connection to the SQL database, log into the connection
with an account with the proper rights, and then execute a SQL
statement to modify the table. Allen Browne has a bunch of examples
on his website.
www.allenbrowne.com
.



Relevant Pages

  • Re: Modify Linked SQL table in Acess via VBA code
    ... Destination is into the linked SQL table via ODBC ... I need to modify one of the linked tables via code (I don't have direct ... since I can't modify a linked table to a SQL database with the ... connection string definition as when I link the table to modify the ...
    (microsoft.public.access.modulesdaovba)
  • Re: Data entry, deletion and modification problems.
    ... the mis-match of provided column and the inserted field. ... Hope you may help to modify it for me, ... con.Execute sql, Recordsaffected ...
    (microsoft.public.access.formscoding)
  • Re: Modify Linked SQL table in Acess via VBA code
    ... string in your code, using the ODBC link information from your ODBC ... The sample SQL I gave you was for the sample question you asked. ... I need to modify one of the linked tables via code (I don't have direct ...
    (microsoft.public.access.modulesdaovba)
  • Re: validation in pass through query
    ... Assuming your P-T is named "qsptCustJobs", you can use DAO code to modify ... You may need to modify the code and do some testing. ... MS Access MVP ... The reason SQL can't evaluate the contents of!... ...
    (microsoft.public.access.queries)
  • Re: ODBC
    ... I cannot modify a remote view. ... The IT as change the version of SQL and since, when i try to modify the ... "Connectivity error: Microsoft ODBC Driver manager" ... Is there a way to modify the connection name without opening the views ...
    (microsoft.public.fox.helpwanted)

Loading