+ Reply to Thread
Results 1 to 6 of 6

Excel sql, recordset & connection

  1. #1
    Forum Contributor
    Join Date
    08-19-2010
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    151

    Excel sql, recordset & connection

    Hello,

    I have an excel application with data file (xlsx) and forms.
    Before opening a form I establish connection to the data file and retrieve information.
    I pass result recordset to the form.

    I need to keep result recordset active during the form life
    but I need to close the connection to the data file.

    My problem: After I close the connection to the data file, result recordset is no longer available.

    After executing a query how can I keep the results and close the connection to the DB file ?

    Thank you for your help

  2. #2
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Excel sql, recordset & connection

    you could create/use a worksheet that is used as a temp data store, then work with the data out of that sheet. then when you are ready to send it back to the DB file you can reopen the connection.
    If you liked my solution, please click on the Star -- to add to my reputation

    If your issue as been resolved, please clearly state so and mark the thread as [SOLVED] using the thread tools just above the first post.

  3. #3
    Forum Contributor
    Join Date
    08-19-2010
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    151

    Re: Excel sql, recordset & connection

    Thank you for your help.

    Can I store query results in recordset which is not depending on the connection ?

    Thank you

  4. #4
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Excel sql, recordset & connection

    If you set the recordset's connection to nothing before you close the connection it should be fine.
    Good luck.

  5. #5
    Forum Contributor tkowal's Avatar
    Join Date
    11-20-2010
    Location
    Miami, Fl
    MS-Off Ver
    Excel 2010
    Posts
    150

    Re: Excel sql, recordset & connection

    You may look at "Disconnected Recordsets" there are plenty of good articles on them.
    http://www.4guysfromrolla.com/webtech/080101-1.shtml

    Still in using them you would have to re-establish a connection to your datasource to re-sync the data..

  6. #6
    Forum Contributor
    Join Date
    08-19-2010
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    151

    Re: Excel sql, recordset & connection

    Hello,

    Thank you for your help. tkowal I will read it now.

    I have a strange problem. If 2 users are trying to open a different copy of my application and open a form which is based on the same excel data file. The second user gets an excel crash.
    Can I use access DB in order to allow multiple excel users to work with the same data source ?
    Why sharing excel data file did not solve this problem and did not allow 2 users to establish connection to the data file (xlsx) ?

    Thank you

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1