+ Reply to Thread
Results 1 to 17 of 17

User Form closes prematurely

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

    User Form closes prematurely

    If you go to the worksheet PTO Log, and click on the submit entry the user form will appear, randomly select a name, put in the amount of hours, when you go to click a "start date", a pop up calendar will appear, once you select a date, both the calendar and the userform, will close, not recording any of the data.
    Here is the line of code that is giving me an issue:
    Please Login or Register  to view this content.
    in both the frmPTOLog and frmPTODelete, the userform prematurely closes, without recording the data. If you take that code out of both forms, the userform works correctly.

    What I was trying to do, was to have the file go back to the Log worksheet after the information was recorded in the calendar.Any ideas?

    Also there is another issue, but I will address that in another thread...also for reference I am using 2010 excel, but this will be used in both 2007 and 2003.
    Attached Files Attached Files
    Last edited by 00Able; 02-24-2011 at 08:26 PM. Reason: Decided to Accept that it doesn't work on my environment thanks for all the input.
    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 Contributor PY_'s Avatar
    Join Date
    09-23-2008
    Location
    Houston
    MS-Off Ver
    Office 2016
    Posts
    289

    Re: User Form closes prematurely

    It did not close for me until i submitted it. Once submitted, it then put the data in row 6.

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

    Re: User Form closes prematurely

    So your saying it works properly for you, if so, can I ask what version of Excel you are using?

    I am not sure why this is giving me issues, and need to gain some insight?

    I don't see how this code could change anything that is related to how the date is submitted, but it quits everytime, I get to that point.
    Last edited by 00Able; 02-22-2011 at 07:33 PM.

  4. #4
    Forum Contributor PY_'s Avatar
    Join Date
    09-23-2008
    Location
    Houston
    MS-Off Ver
    Office 2016
    Posts
    289

    Re: User Form closes prematurely

    It worked fine in both 03' and 07' fo me. The Submitting and Deleting.

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

    Re: User Form closes prematurely

    can you check my other post regarding this same form (attachment), and see what your results are?

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

    Re: User Form closes prematurely

    Is it possible that by adding the code
    Please Login or Register  to view this content.
    , somehow in 2010 excel it is interpretting it as unload the userform?

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: User Form closes prematurely

    Using the form allows the dates to be entered & the submit button works.

    Y
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  8. #8
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: User Form closes prematurely

    It worked fine in 07' fo me. The Submitting and Deleting.

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

    Re: User Form closes prematurely

    Any ideas why my it wouldnt work in 2010?

  10. #10
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: User Form closes prematurely

    Works for me in 2010.
    Remember what the dormouse said
    Feed your head

  11. #11
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: User Form closes prematurely

    Hi 00Able

    As you know, you and I have spent a significant amount of time on this project. At my suggestion (because your original thread was marked as "SOLVED"), you posted a new thread in order to get feedback from all the talent on the site and I've followed your new thread.

    Here's my observations. I downloaded your attached file and WAS able to duplicate this consistently on the downloaded file
    once you select a date, both the calendar and the userform, will close, not recording any of the data
    I assumed you had modified some code SOMEWHERE that was causing the issue...so, I went through the code, line by line, comparing your code to what I'd provided.

    Now, there's a lot of code...but, except for inconsequential differences, I could NOT find the problem. So, I saved your downloaded file to a new file "PTOCalendar11v12.xls". I ran the code in THAT file and it performed as expected. So, I'm thinking "What the heck is going on here". I closed the v12 file and re-opened the v11 file (your download). The code now runs as expected in the v11 file. I'm stumped.

    I'm going to run more tests on the v12 file...if I can't break it, I'll upload it for your perusal. I don't have any clue what's going on.

    PS:
    Unload me
    does just that
    unload the userform
    That's what the line of code is meant to do.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  12. #12
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: User Form closes prematurely

    hi

    00Able,
    Based on John's comments of closing & reopening, you may find it helpful to run Rob Bovey's Code Cleaner addin (http://www.appspro.com/Utilities/CodeCleaner.htm) over your project.

    John,
    Sounds like you've done a fair bit of work on this, "comparing code line by line". Here's a link to some freeware that I find very useful for comparing vba code: http://www.formulasoft.com/vba-code-compare.html

    hth
    Rob
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

  13. #13
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: User Form closes prematurely

    Hi Rob

    Actually, I used just that. Thanks.

    The issue I've found with Code Cleaner is that it also removes any comment lines you've inserted for documentation. I've not used it for some time because of this. Has it changed?
    Last edited by jaslake; 02-23-2011 at 07:38 PM.

  14. #14
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: User Form closes prematurely

    hi John,

    I'm not sure about earlier versions of CodeCleaner but version 5.0 allows you to leave the code comments. This can be done when you select your Project to clean on the "Projects" tab & then you decide what gets done by (un)ticking various nested options on the "Options" tab.
    Do you ocassionally export & re-import modules manually, at some point in time, to ensure that any "invisible junk" is removed?

    hth
    Rob

  15. #15
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: User Form closes prematurely

    Hi Rob

    I'm not certain what version of Code Cleaner I've used in the past as I've removed the utility because of my perceived limitations. I'll revisit it based on your comments.

    Rob, I appreciate all the help you've given me the last several years. One doesn't get the opportunity to thank mentors personally...you've been one to me. Thank you.

  16. #16
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: User Form closes prematurely

    hey John,

    Thanks for the compliments
    It works both ways - If you weren't the person you are, then I could be wasting some time when making suggestions BUT you are who you are, so Thank you

    While I'm at it (turning the thread into a group hug!), there are 2 of my mentors here too - thanks RS & Roy

    The way I see it, we're all learning - let's keep it up

    Rob

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

    Re: User Form closes prematurely

    John, all I did in this case is go back to the original thread and pull the file directly from your attachment, delete the previous items in the log, and enter in the "example" data, and then copy that one line of code, press save it and attach it to the post...

    so the file is your file, nothing was changed except that one line of code...
    Please Login or Register  to view this content.
    I think it has to do with my environment...thats all I can think of.
    Group Hug time:
    I really appreciate all the time you have spent assisting me on this and other issues and hope your aware of the deepest gratitude that I have. One day I hope to be able to assist people like (all of) you do.

    Please don't spend any more time beating this old cow, if this is working for everyone else...there is no point. It is primarily set up in the 2003 environment, so I am sure it will be fine. I just don't understand why it wouldn't work for my environment.

    I am going to mark this as Solved, as I am comfortable with all the input given to this particular thread. Perhaps a quirk in 2010 has been found, hmmm or the 9th wonder of the world...lol

+ 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