• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Trying to auto-populate text box on user form

Steve DeWeese

New Member
I have a user form that I put together by modifying a tutorial. The user form has 27 inputs that are either text boxes or combo boxes. The tutorial combines the first name and last name boxes into a full name box, so I tried to use that same approach to combine a couple of other boxes. I am trying to combine a combo box named Reg6 with a combo box named Reg14 and a combo box named Reg13. I don't want any spaces between these values and I would like the result to populate a text box named Reg27. For example:

Reg6 contains 9, Reg14 contains CLSS and Reg13 contains 1.5 I would like Reg27 to populate with 9CLSS1.5 prior to adding everything to the database. The code I modified works fine for first and last name. That code is

[Private Sub Reg2_Change()
'get full name
Me.Reg3.Value = Me.Reg2.Value + " " + Me.Reg1.Value
End Sub]
In the above example Reg1 contains the last name, Reg2 the first name, Reg3 automatically populates with the full name

I modified with the following but can't get it to work. I tried switching around the different box names in the Private Sub line and can get 2 out of 3 to populate but never all 3.

[Private Sub Reg14_Change()
'get the classification
Me.Reg27.Value = Me.Reg6.Value + Me.Reg14.Value + Me.Reg13.Value
End Sub]

Thank you,

Steve
 
Hi:

The code you have given seems to be fine. could you please upload your workbook , there could be something else which would be causing the error

Find the sample I tested go to vba editor and run the macro and change the combobox2 the textbox is taking the values.

Thanks
 

Attachments

  • Book1.xlsm
    12.7 KB · Views: 10
Very strange.....now it is working on my end too. No changes other than shutting down and rebooting my laptop later..

I would appreciate input on how I could add some additional error checking to the entry form. As an example, a student that has a Start / Stop checked as Y must also have a setting of ISM. Those fields are Reg15 and Reg14.

Thank you for your help,

Steve
 

Attachments

  • Student Accomodations Sample.xlsm
    326.7 KB · Views: 8
Hi:

I could not make out what you want, Is that when Start / Stop drop down is Y you want Setting drop down to automatically populate as Y Or I misunderstood your requirement. Please elaborate a little more.

Thanks
 
If the Start / Stop drop down is selected for Y and the Drop down for Setting is anything other than ISM, I would like a warning text that "Setting must be changed to ISM for this accommodation".
 
That is perfect! Thank you so much for your help. I am always humbled by the expertise I find here and the willingness to help. I wish I could reciprocate but my skills in this area are quite limited. Thank you again!
 
Back
Top