Results 1 to 2 of 2
  1. #1
    macsterling is offline Novice
    Windows 7 Access 2007
    Join Date
    Jul 2008
    Posts
    2

    inserting into a SQL2005 db from Acess 2007 DB

    I have a SQL 2005 database called HWG with a table in it called Contacts. There are a number of columns but I am only interested in FirstName, LastName, and Workemail all nvarchar.

    I also have a Access database called “Copy of Main Client DB” (note spaces in name) with a table in it called emails. There are several columns, but I am only interested in “Last Name”, “First Name”, and EmailAddress (note spaces in the column names)



    For the price of a few cigars, I need you to help me with the following task - I need to insert a row in the SQL database filling only the FirstName, LastName, and Workemail columns. The data will come from the Access database “Last Name”, “First Name”, and EmailAddress columns.


    I have both databases on each of two computers (trying different solutions) and have tried the following.

    On one computer (32 bit XP) I set up an ODBC link from the Access to the SQL database and can perform a select * from the Access DB looking into the SQL db. I am not able to do the insert into the SQL db I get the infamous “syntax error” (That is Microsoft for “you made a mistake, stupid, and if you are that dumb I am not going to help you by giving you any more information.)

    On the other computer, 64 bit w7) I have, from within SQL 2005, created a linked server (using the SQL Below) called HWG. I do not know how to reach into the access database and pull the data for the insert.

    sp_addlinkedserver 'HWG', 'Access 2007', 'Microsoft.Jet.OLEDB.4.0',
    'c:\Macs Stuff\Copy of Main Client DB.mdb'

    (I think I have discoverd that Microsoft.Jet.OLEDB.4.0 will not run on a 64 bit machine)


    In either case, How do I write a SQL that that will cause a new row to be created in the SQL DB from the Access DB?



  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    21,322
    The typical method would be to link to the SQL Server table within Access. From there, it's a simple append query:

    INSERT INTO SQLTableName(Field1, Field2)
    SELECT Field1, Field2
    FROM AccessTableName

    If you post the SQL that gets you the error, we should be able to fix it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Acess 2007 & SQL question
    By willigiann in forum Forms
    Replies: 3
    Last Post: 09-15-2010, 09:54 AM
  2. inserting .wav sound?
    By dada in forum Programming
    Replies: 2
    Last Post: 08-20-2010, 11:25 PM
  3. Open a word dotx from acess
    By frcastro in forum Access
    Replies: 9
    Last Post: 06-17-2010, 12:56 PM
  4. Acess autopopulate a query
    By stendec in forum Access
    Replies: 0
    Last Post: 10-20-2009, 03:49 PM
  5. Acess 2007 Validation Problem- HELP!?
    By JackLowe in forum Access
    Replies: 1
    Last Post: 04-20-2009, 12:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums - Senior Forums