Opening Same Form with two different command button with different results

  • Hello!

    Is it possible to open the same (userform1) with two different command buttons and get different results. The first button (INSERT) on (userform3)is to open the userform Cust_Line_Order_Form (with textboxes) in a blank value state.

    a button on this form then opens Userform Product Table.

    a command button (OK) on (userform Product Table) is to open the userform1 with values filled into the textboxes. A value selected from a listbox on userform Product Table, activates the value in a cell on a worksheet "INVENTORY".

    That value plus additional cell values are to show in USERFORM1 textboxes.

    So far it crashes.

    button 1 (INSERT):

    Code  '<-- opens form in blank value state...just a userform with blank textboxes

    commandbutton 2 on userform (Cust_Line_Order_Form)... opens userform (Product table) with a listbox of thousands of product... I hightlight product needed and hit "OK" command button that has this code:

    unload me

    In the userform_Activate() for userform Cust_Line_Order_Form

    I have code:

    Optionbutton1.visible=True '<--- has nothing to do with values
    me.textbox3.value = sheets("Inventory").activecell.value

    Once I can get this to work I plan to use the offset function to complete the other textboxes. However, It crashes.

    Obviously because I am trying to open the same userform in two different states but I can't figure out if there should be an (IF) statement or any other kind of "work around".

    I am basically trying to process a customers order. The Cust_Line_Order_Form will contain each line items values. Once the line items are entered, this form will go back to blank values waiting for the next line's values.

    Any help?

  • Attach your workbook

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!