Form submitted calls for another form for username to...

albertc30

Well-known Member
Joined
May 7, 2012
Messages
1,091
Office Version
  1. 2019
Platform
  1. Windows
Hi all.

I have a userform that shows up first time ever the spreadsheet is opened/executed.

This is to ask user for company details. This also adds details of manager.

Once this data is submitted, I want a form to show with for example;

Welcome "Manager name". Please enter a username of your choice and a password.

Once this form is submitted then the whole process is completed. Company file has been created along with the ever first user which without, nobody would have access to the spreadsheet.

I have got the form done up but for the part where the data on the textbox field is to be loaded from data on previous field I haven't got a clue.

I have spent big time of my day looking on the internet and could not find anything remotely like what I want. Perhaps I am not looking for the right thing.

One thing I know is I have had enough of bigresource website that just links me to MRExcel and/or other sites.

Fields on my initial form for name are;

Form is called Bdetails_form and managers details are as follow;

Initial = MD_CB_Title
First name = BD_TB_MD_fname
Last name = BD_TB_MD_surname

This new userform asking Manager to enter username and password is called MD_UP_details.

I wanted to add username automatically generated by grabbing first 5 characters from surname and adding first name initial and just prompt user for password, but this looked too much for me and again, a good part of the day looking and digging but nothing was found. Please bare with me as my VB skills are mediocre to say the least.

Many thanks for all the help/support given in the past and a much deserved well done to all of you out there willing to land a helping hand to those of us whose skills need perfecting.

Regards,
Albert
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Well Albert, your problem is an easy one to solve. There are two ways of doing this, and depending on what else needs to be done with the data from the 1st form, you can choose:

  1. If the data is not used elswhere (unlikely) then what you want to do is that when the user clicks OK on the first Userform, the button_click sub sends the correct data to the 2nd userform. It does this by calling the 2nd userform and setting the the label text to the required text:
    Rich (BB code):
     MD_UP_details.Label1.caption = "Hello " & BD_TB_MD_fname & " " & BD_TB_MD_surname & ". Please enter a username of your choice and a password."
  2. More likely is that the click of the command button stores the username somewhere in the sheet, so that this does not need to be repeated every time. In that case you can read the data from the sheet when the MD_UP_details form opens.

For this you use the Userform_Activate sub (in the userform code editor, click on the top left dropdown box, select Userform, then in the top right dropdownbox select Activate. The macro skeleton will be created.)
In this macro you can read the values into the label from the cells where you stored it. Best to use named ranges for these cells - they will always be valid even if rows or columns are added / removed!
Rich (BB code):
 Label1.caption = "Hello " & Range("UsrFirstName") & " " & Range("UsrSurName")  & ". Please enter a username of your choice and a password."



You get the gist I hope. let me know how you are getting on.
 
Upvote 0

Forum statistics

Threads
1,216,571
Messages
6,131,475
Members
449,652
Latest member
ylsteve

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top