+ Reply to Thread
Results 1 to 9 of 9

save excel in access

  1. #1
    Registered User
    Join Date
    07-10-2007
    Posts
    31

    save excel in access

    hi,

    How do i save my data to access from excel. This will import from access.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    You may use this code (in this example I write rows from 2 to 10 and columns from 1 to 5 in an Access table):

    Please Login or Register  to view this content.
    Regards,
    Antonio

  3. #3
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    You can also use this methos for update:
    Please Login or Register  to view this content.
    Regards,
    Antonio

  4. #4
    Registered User
    Join Date
    07-10-2007
    Posts
    31
    thanks very much.

    What about transaction processing . I want to update data to 3 tables and want to do it at once.

    Now I could either use the access cascades on update I believe or use some sort of transaction staement from VBA which I prefer. Can I do this?

  5. #5
    Registered User
    Join Date
    07-10-2007
    Posts
    31
    I get this error with the code
    //item cannot be found in colection corresponding to name or ordinal ? on col row 2,2 where data exsits? I set up table 2 with 1 field.
    I set up 5 cols and 10 rows of numbers.

    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    When you open a recordset for update you need to do attention at the number of fields you reference in the select instruction.

    For example, if I do:
    Please Login or Register  to view this content.
    May be you get error because in your 'select' instruction you referenced less than 5 fields and when code try to set rs(4) value it gets error.

    Regards,
    Antonio

  7. #7
    Forum Contributor Tarball's Avatar
    Join Date
    04-21-2007
    Location
    Atlanta, GA
    Posts
    166
    Please Login or Register  to view this content.
    this is failing on your first iteration because the ordinal is not in your collection. Inthe first pass, C=1. You set your recordset=C-1 (which evaluates to 0). The collection does not hold a value for this position in the recordset which is why you get the error saying the ordinal is not in your collection.

  8. #8
    Registered User
    Join Date
    07-10-2007
    Posts
    31
    Hi,

    The previous posts have contradicted each other (as it seems to me but correct me if I am wrong. One says I can have
    rs(c - 1) = Cells(r, c) // where rs(0) is the 1st and the other says i can't have rs(0)?


    /...
    Hang on rs(0) is all I need as i have less than fields. Lt me check my code again.

  9. #9
    Registered User
    Join Date
    07-10-2007
    Posts
    31
    Ok it works fine thanks.

    Can I do some transaction statments from VBA as well. Access has cascades on deletes etc but I prefer to do them manually.

    I want to update data over 3 tables .

+ 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