Results 1 to 4 of 4
  1. #1
    Dapiaoen is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    2

    Question MS Access with ASP: Blank rows being appended with copy from source to target

    I have two MS Access databases (source and target). I am copying 5 tables from the source to new tables in the target. I'm using an ASP script on a web site. This is a repetitive process that has to be done every few weeks by users. All source tables have no empty rows. Same code to copy the tables, with each source and target passed in to the subroutine. Four of the tables copy perfectly with a SELECT data cursor and then INSERT each row within the loop. The problem table copies fine -- except: I display a process bar and and count each INSERT and the result is always 95247 rows INSERTed. The exact number in the source table. However, the target table has 102,432 rows -- the extra rows are all blank. There are no empty rows in the source and, in fact, I SELECT DISTINCT and then further test if a key column is blank or Null before doing the INSERT. The happens every time, as I've tested it probably 15 times. Code can't be copied from an off-line system, but here's the psuedo:
    Select Cursor from Source
    Do Until EOF
    If key not blank and not Null
    - Insert row into Target and count + 1
    End

    MoveNext
    Loop
    Close cursor


    Display Insert count (95247)
    I've had to add Delete blank rows, but should not have to






  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    I know you are saying inserting to a new table but perhaps your target table already has blank fields in it before you start? - maybe hidden because of a filter? or some other code that does something to it once created?

    And your pseudo code doesn't cater for I display a process bar perhaps there is something there which causes an insertion of a blank line? presumably it is updated every 10 insertions or so

  3. #3
    Dapiaoen is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    2
    Quote Originally Posted by Ajax View Post
    I know you are saying inserting to a new table but perhaps your target table already has blank fields in it before you start? - maybe hidden because of a filter? or some other code that does something to it once created?

    And your pseudo code doesn't cater for I display a process bar perhaps there is something there which causes an insertion of a blank line? presumably it is updated every 10 insertions or so
    Apologies. For all 5 tables the first step is to DELETE * FROM tableX. So the table is empty. Yes, the process bar is in the loop and for every 250 INSERTS I display a tick (|). All the other tables copy perfectly and I double check that the key value is NOT blank or NULL so getting blank rows is weird.

    Thanks for your reply. I'm still working on this one.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    What exactly is the code to insert the row? If you're using INSERT INTO...SELECT...WHERE, perhaps there are duplicates of the field(s) in the WHERE clause.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Update target where source <> ""
    By peak@accessforums in forum Queries
    Replies: 4
    Last Post: 03-16-2015, 10:46 AM
  2. Access : Null / Blank rows select
    By jagadeesh.rt in forum Access
    Replies: 4
    Last Post: 09-11-2014, 12:26 AM
  3. Replies: 4
    Last Post: 07-23-2014, 04:13 PM
  4. Replies: 3
    Last Post: 03-07-2014, 03:59 PM
  5. Replies: 7
    Last Post: 08-26-2013, 06:05 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums