Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2013
    Posts
    3

    Unanswered: Movefirst function messes up pasted data from Excel (MS Access 2010)

    Hi all,

    I am working on a database in which I manually paste data from Excel into a subform i MS Access, which is linked to a table.
    The table consists of an index column, which labels each "batch" of pasted data. This index grows by one from each time I paste the data.
    I use the Movefirst - Edit - Update functions in the "AfterUpdate" module to change the index value each time the data is pasted.

    Just pasting the data is not a problem. The problem is that when I change the index number the first row of data in my Excel sheet is deleted and an additional row below my Excel data is created and selected in edit mode.
    The consequence of this is that the table, which the subform is linked to, is not updated instantly.
    I can solve this by inserting a blank row in row 2 of my Excel sheet, by pressing escape and hitting refresh.
    I would however like this to happen automatically as I am building the database to some end users who don't know MS Access.

    I have attached a txt file with the VBA code.

    I hope someone out there can help me.

    Thanks,
    ulle51
    Attached Files Attached Files

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    495
    Provided Answers: 24
    you dont need MoveFirst, its a given. The 1st record is 1st, so no need to advance to it.

  3. #3
    Join Date
    Nov 2013
    Posts
    3
    Thanks for your swift response and the tip.
    It however doesn't resolve the problem no matter whether "Movefirst" is included or excluded.
    Has anyone experienced this issue?

    Thanks,
    ulle51

  4. #4
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    Without more info on what precisely what you are trying to do it is difficult to be sure what to suggest, but one thing that is a bit odd is you are updating a record without changing anything.
    ie. I think this
    Code:
    RunVersion = rs1![RunNbr]
    should by this
    Code:
    rs1![RunNbr] = RunVersion
    ??

    An alternative approach might be to use an Update query executed against the required table?

    HTH


    MTB

Posting Permissions

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