+ Reply to Thread
Results 1 to 10 of 10

multiple userforms problems

Hybrid View

scott micklo multiple userforms problems 02-13-2018, 09:07 AM
Norie Re: multiple userforms... 02-13-2018, 09:21 AM
scott micklo Re: multiple userforms... 02-13-2018, 09:24 AM
scott micklo Re: multiple userforms... 02-13-2018, 09:36 AM
Norie Re: multiple userforms... 02-13-2018, 09:46 AM
scott micklo Re: multiple userforms... 02-13-2018, 09:54 AM
Norie Re: multiple userforms... 02-13-2018, 12:05 PM
scott micklo Re: multiple userforms... 02-13-2018, 12:16 PM
Norie Re: multiple userforms... 02-13-2018, 03:39 PM
scott micklo Re: multiple userforms... 02-13-2018, 04:51 PM
  1. #1
    Forum Contributor
    Join Date
    07-08-2015
    Location
    Indiana
    MS-Off Ver
    Excel 2007
    Posts
    128

    multiple userforms problems

    hi experts

    I have a program that loads a userform for input of data, it takes the data, crunches it and displays it on a sheet --- its not elegant and i believe its way too long and can be done a lot cleaner. BUT -- that is another issue for another day.

    My issue right now is this -- from Userform1, I need to have another userform (call it Userform2) load to accept data and determine the time lapse, accept the down codes, and move on and display it. My problem at hand is that I can get Userform2 to load, but can not get it to prefill the textboxes. I have tried reading the data from Userform1 into Userform 2 -- found out userforms are modal and can not do that. So I tried to read it from either variables or from the sheets they were put in . But nothing is working.

    I am unsure what my problem is.

    I can not attach my program as its too large. I am however, putting the code in this window that is relevant. Again I realize that this is long and can be much much cleaner -- but right now I need to get this running .

    Is it an issue of having 2 userforms open at once? I can get Userform2 to load up, but thats all.


    Thanks in advance for assistance.

    Unload UserForm1
     '   *************************************************************************************************************
     
      ' dcdone = False        ' boolean catcher for if ll down codes inpout
     
     'Do                     '  loop to get all down codes
     
        ' prefill data
        UserForm2.txtpn2.Value = Worksheets("Daily Run Data").Cells(nr, pnc).Value
        UserForm2.txtdescrip2.Value = desc
        UserForm2.txtdt2.Value = UserForm1.txtdt.Value
        UserForm2.txtline2.Value = ml
        
        
      Load UserForm2         ' imput screen for downtime codes
        
        
        
        Unload UserForm2
    
    'Loop Until dcdone = True            '  no more down codes to input

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: multiple userforms problems

    If your userforms are modal it doesn't prevent one reading from the other.

    You probably want to hide the one you are reading from, read the data from it to the other form and then unload the first form when you are finished with it.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    07-08-2015
    Location
    Indiana
    MS-Off Ver
    Excel 2007
    Posts
    128

    Re: multiple userforms problems

    I have "showModal" set to FALSE. Is this correct?

  4. #4
    Forum Contributor
    Join Date
    07-08-2015
    Location
    Indiana
    MS-Off Ver
    Excel 2007
    Posts
    128

    Re: multiple userforms problems

    OK. SO I have the showModal set back to TRUE, and I am getting the userform2 to load.

    But, It is not prefilling the data as in the code above. I have run this with msgbox to check and data is all there.

    Is there something that i am missing in my code or a setting to prefill the userform2 with the data? I ihave checks and textbox names are all matching, and my code is exactly like my code earlier in my program where I prefill userform1.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: multiple userforms problems

    Scott

    Are you still unloading the first userform?

    Where is the posted code located and how is it being executed?

  6. #6
    Forum Contributor
    Join Date
    07-08-2015
    Location
    Indiana
    MS-Off Ver
    Excel 2007
    Posts
    128

    Re: multiple userforms problems

    Yes. I am unloading userform1 before attempting to prefill userform2.

    The code/program is 35mb, too large to attach.

    The snippet of code is in the main post above.

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: multiple userforms problems

    Like I said in my first post, you don't unload the first userform.

    Hide it, get the data from it and then unload it.

  8. #8
    Forum Contributor
    Join Date
    07-08-2015
    Location
    Indiana
    MS-Off Ver
    Excel 2007
    Posts
    128

    Re: multiple userforms problems

    Quote Originally Posted by Norie View Post
    Like I said in my first post, you don't unload the first userform.

    Hide it, get the data from it and then unload it.

    OK. I think I was getting confused with unload and hide.

    So code wise,
    Userform1. hide
    prefill userfrom2
    unload userform 2
    unload userform1
    ????

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: multiple userforms problems

    Not quite, you don't want to unload userform2.

    1 Hide userform1.

    2 Load userform2.

    3 Transfer data from userform1 to userform2.

    4 Unload userform1.

    5 Show userform2.

  10. #10
    Forum Contributor
    Join Date
    07-08-2015
    Location
    Indiana
    MS-Off Ver
    Excel 2007
    Posts
    128

    Re: multiple userforms problems

    THANK YOU VERY MUCH!!!

    Got it working and learned in the process.

    Thanks again!!!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Multiple userforms
    By 1976dan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-22-2013, 09:52 PM
  2. Data Entry UserForms color change problems
    By Bolton9190 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 03-15-2013, 01:54 PM
  3. Problems with "Adding" in userforms
    By jazz_bass in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-26-2012, 10:13 AM
  4. Two problems with userforms
    By Derek Dowle in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-08-2006, 10:10 AM
  5. program problems with userforms
    By john.9.williams@bt.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2005, 08:06 AM
  6. problems with userforms
    By john.9.williams@bt.com in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2005, 02:07 AM
  7. UserForms:listbox display problems
    By Emilie in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-23-2005, 01:06 PM
  8. [SOLVED] problems with userforms
    By john.9.williams@bt.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2005, 10:24 PM

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