Results 1 to 6 of 6

Thread: progressbar problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Posts
    179

    progressbar problem

    hi
    i am using vb 6 and ms access. i want to delete data from a table of an access database which contains about 5,000 records and i have a progressbar. But when the deletion process starts the progressbar should run as the records are deleted.
    what i was thinking was to
    1)first find out howmany records are present in the table
    2)then divide that value with the progressbars max value,
    3)delete the records with the remender that u get and increase the progressbar value by 1
    but i am a bit confused with it so can u help me with some of ur ideas.
    i am using adodc connection
    can some one help me with the code.
    Last edited by amit_m04; Sep 15th, 2002 at 02:28 AM.

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    you should be able to delete them in one statement that would take about a second... how are you going about deleting them.. you should use a sql delete statement

  3. #3
    PowerPoster
    Join Date
    Aug 2001
    Location
    new jersey
    Posts
    2,904
    if you're doing it in what Matt has properly pointed out would be the hard way of doing it yourself in a loop, and you really want to do it that way, and the progress bar doesn't progress, then you probably need a "doevents" in your loop.

  4. #4
    Let me in .. techyspecy's Avatar
    Join Date
    Aug 2002
    Location
    Back to VBF.
    Posts
    2,456
    No matter what you are using for deletion of Records, i do not think you can achieve this task, unless, you could put some artificial intelligence in your program.

    If you are going to write a loop to do this, and fire SQL query to delete the records one by one, you could achieve this, but thats a horrible way of deleting records. Its gonna take more time and resources.

    If you fire only one SQL query to delete all, you cannot achieve this, because neither SQL nor VB tells you, while deleting the records, that how many records are already deleted.

  5. #5
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    Originally posted by techyspecy

    If you fire only one SQL query to delete all, you cannot achieve this, because neither SQL nor VB tells you, while deleting the records, that how many records are already deleted.
    and even on a slow connection/computer it would happen fast enough to not need a progress bar...

  6. #6
    Frenzied Member moinkhan's Avatar
    Join Date
    Jun 2000
    Location
    Karachi, Pakistan
    Posts
    2,011
    To make progressbar work for displaying deletion.. what you can do is;
    Populate a Dynamic (pessimistic), recordset..
    VB Code:
    1. While NOt myRSet.EOF
    2.        myRSet.Delete
    3.        Progressbar1.value = Progressbar.value+1
    4.        myRSet.MoveNext
    5. Wend

    But this approach is really very slow.. you can delete the entire contents of the table using a single command..but if Progressbar is tooooooooooooooo necessary I think you have to use the above option..

Posting Permissions

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



Click Here to Expand Forum to Full Width