Fetching data from an SQL Server in to an Access database

  • Hi Everybody,

    I am trying to fetch some data from an SQL Server Database.

    I have a query, but it keeps prompting for credentials.

    SELECT Invoices.NavisionInvoiceNumber, Invoices.NavisionInvoiceDate, Invoices.NavisionCustomerNumber, Invoices.NavisionCustomerName, Invoices.NavisionTotalDeliveries, Invoices.FilesDistributed, Invoices.IsComplete, Deliveries.DeliveryNumber, Deliveries.PDFName, Deliveries.NumberOfTries, Deliveries.FilesMoved, Deliveries.HasFailed, Deliveries.IsComplete

    FROM LVA.dbo.Deliveries Deliveries left outer join LVA.dbo.Invoices Invoices on Deliveries.InvoiceId = Invoices.Id ORDER BY Invoices.NavisionInvoiceNumber, Deliveries.PDFName

    It keeps asking for an DSN (The DSN is on a networkshare)

    How can i make sure that it goes automatically?

    Edit: It has to be imported in Access 2010

    Regards,

    Robert

  • Is the the right subforum for this question?

  • rpouwels (9/25/2012)


    Hi Everybody,

    I am trying to fetch some data from an SQL Server Database.

    I have a query, but it keeps prompting for credentials.

    SELECT Invoices.NavisionInvoiceNumber, Invoices.NavisionInvoiceDate, Invoices.NavisionCustomerNumber, Invoices.NavisionCustomerName, Invoices.NavisionTotalDeliveries, Invoices.FilesDistributed, Invoices.IsComplete, Deliveries.DeliveryNumber, Deliveries.PDFName, Deliveries.NumberOfTries, Deliveries.FilesMoved, Deliveries.HasFailed, Deliveries.IsComplete

    FROM LVA.dbo.Deliveries Deliveries left outer join LVA.dbo.Invoices Invoices on Deliveries.InvoiceId = Invoices.Id ORDER BY Invoices.NavisionInvoiceNumber, Deliveries.PDFName

    It keeps asking for an DSN (The DSN is on a networkshare)

    How can i make sure that it goes automatically?

    Edit: It has to be imported in Access 2010

    Regards,

    Robert

    The details are pretty sparse here. You are trying to import data from sql server to Access? How are you trying to do this import?

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Hi Sean,

    I am trying to import the data in to Access from an SQL Server Database.

    I already have the data imported, but Access keeps bugging me with the location for the DSN file. Is it possible for Access to find the DSN file, because I want to have everything automated for the end users.

    Or is there another way to import the data?

  • Are you using a Pass-Through Query in Access? If so, right-click the query, open it in Design View, and open the Property Sheet. The second item in the list should be ODBC Connect String; click the box to the far right on that line, and it should prompt you for the DSN to use for that query. Point it to the one you'd like to use, and the query should automatically use that DSN from now on. If you're using a query written in Access Visual Basic, you'll need to write a connection string to use with the query; there's quite a few utilities on the web that can generate one for you given some details.

    - 😀

  • rpouwels (9/25/2012)


    Hi Sean,

    I am trying to import the data in to Access from an SQL Server Database.

    I already have the data imported, but Access keeps bugging me with the location for the DSN file. Is it possible for Access to find the DSN file, because I want to have everything automated for the end users.

    Or is there another way to import the data?

    Are you saying you import this data repeatedly? If so, can you create a view in sql instead? It seems highly inefficient to me to import data over and over.

    Do you have the DSN setup on the machine for each user? Can you instead use some VBA and create an ADO connection rather than using a machine DSN?

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • hisakimatama (9/25/2012)


    Are you using a Pass-Through Query in Access? If so, right-click the query, open it in Design View, and open the Property Sheet. The second item in the list should be ODBC Connect String; click the box to the far right on that line, and it should prompt you for the DSN to use for that query. Point it to the one you'd like to use, and the query should automatically use that DSN from now on. If you're using a query written in Access Visual Basic, you'll need to write a connection string to use with the query; there's quite a few utilities on the web that can generate one for you given some details.

    I am using a Pass-Through Query... I will try it!

    Edit: Thanks, Hisakimatama, It worked 🙂

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply