+ Reply to Thread
Results 1 to 2 of 2

Code will delete first 2 rows but not the remaining 10

Hybrid View

  1. #1
    Forum Contributor 00Able's Avatar
    Join Date
    11-17-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    244

    Code will delete first 2 rows but not the remaining 10


    A quick description of the file:

    Its a vacation log, to enter a persons vacation request I go to the PTO Log, click submit entry and enter the data. It will store the info in the actual log (same worksheet) and in the Calendar, under the Month tabs. If someone changes their mind, or is terminated ect., I can delete the record, by using the Delete Entry userform. This will delete the record from both places.


    The Issue:

    In the attached userform if you go to the worksheet PTO log, you will see that there are 4 people entered to have vacation between March - December.
    1. White,J
    2. Johnson, K
    3. Harkle, P
    4. Swope, D

    (I only ran this as a test, so this is not a "real life" scenerio, but it will help show an issue with the code)

    Now if you click on the month "March" you will see that 5 people are off everyday. JPogue, being the person missing in the "PTO Log", this is because I used the "Delete Entry" userform and deleted JPogue from the calendar.

    What I expected to Happen
    JPogue would dissappear from both the "PTO Log" and from where the range of dates that was selected in that row, that I picked. So basically Feb 23 - Dec 28th, where if you look in each month label worksheet you will see his name.


    What Happened
    JPogue's record in the log was deleted, but his name is still in the Calendar.

    So, if you press the "Delete Entry" userform on the PTO Log, and select the line with "DSwope" the same thing will happen, as I just explained above.

    If you perform the same task, but this time choose either "KWhite" or "KJohnson" (the first 2 entries for the date) what I expected to happen for the other entries will happen. In other words, It works correctly.

    So the problem seems to be that it will only delete records for the first 2 entered on the same date, after 3 people are entered on the same date it will not delete those fields. Not a problem everyday, but on Mondays, Fridays, and before and after Holidays is a big issue, as we can have 12 people schedule off a day.
    Attached Files Attached Files
    Last edited by 00Able; 02-22-2011 at 07:27 PM.
    Providing Problems for Your Solutions
    STARS are my Punching Bag, You will be rewarded.

    In the rare event that I may help you, feel free to make me see STARS

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,642

    Re: Code will delete first 2 rows but not the remaining 10

    Hi there,

    I've taken only a VERY quick look at your workbook and code, so I'm not claiming to have any sort of in-depth knowledge of what's happening!

    What occurs to me is that the records which are being deleted successfully (i.e. those in the first two rows of the log worksheet) have "FALSE" entered in the "Early Request" column, whereas the "problem" records have no value entered.

    If you look at the individual month sheets you'll see that the White and Johnson entries (i.e. the "non-problem" ones) all include the text "False", but entries for other employees display a blank value between the commas. (Shouldn't they display a value of either True or False?)

    If you click on the "Delete Entry" button, select the "Swope D" entry, and click the OK" button, the "cboConcat" textbox on the "frmPTODelete" form will contain the text string "Swope, D, False, 8" (without quotes). If you now MANUALLY delete the "False" characters (but still leave a space between the commas) and click on the "Submit Entry" button, the "Swope D" records will be successfully deleted from the individual month worksheets.

    I know I haven't found a solution to your problem, but maybe I've given you an idea of where the problem might lie.

    I hope this is of some help to you - please let me know how you get on.

    Regards,

    Greg M
    Last edited by Greg M; 02-23-2011 at 08:40 AM. Reason: "If you click on ..." comment added

+ 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