+ Reply to Thread
Results 1 to 8 of 8

Import Data from Excel into Access

  1. #1
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Import Data from Excel into Access

    Hi,

    I'm trying to get Excel 2007 to send some data to an existing table in Access, the amount of data can vary in size so needs to be dynamic.

    Please Login or Register  to view this content.
    code currently errors on the line Set rs = conn.OpenRecordset("ChannelGroupList", dbOpenTable)
    as this is wrong, but i need to be able to open the record at this location!

    what am i doing wrong?

    thanks

    Jonathan
    Last edited by Jollyfrog; 09-28-2010 at 06:09 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Import Data from Excel into Access

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,009

    Re: Import Data from Excel into Access

    You are confusing ADO and DAO. An ADODB.Connection object does not have an OpenRecordset method (nor would dbOpenTable mean anything to it as that's a DAO constant). You need something more like:
    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

  4. #4
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Re: Import Data from Excel into Access

    Ah Fantastic, i can now grab all the data from my storage sucessfully :-)

  5. #5
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Re: Import Data from Excel into Access

    Hmm ok now when i try to add new data i get a different error!

    Please Login or Register  to view this content.
    It compiles nicely but then errors on rst.AddNew ' create a new record
    with current recordset does not support updating. this may be a limitation if the provider, or of the selected locktype
    Last edited by romperstomper; 09-23-2010 at 09:10 AM. Reason: correct closing code tag

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,009

    Re: Import Data from Excel into Access

    Spot the difference between your code and what I posted...
    (by default you get a forward only, read only cursor)

  7. #7
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Re: Import Data from Excel into Access

    Ah and now it all makes sense

    thanks for your help, i'm very grateful :-D

    Jonathan

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,009

    Re: Import Data from Excel into Access

    Glad to help.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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