+ Reply to Thread
Results 1 to 11 of 11

Text Box not working in userform

  1. #1
    Registered User
    Join Date
    03-24-2016
    Location
    Nicaragua
    MS-Off Ver
    2016
    Posts
    40

    Text Box not working in userform

    Hello Excel Forum,

    Looking for help as usual. I am completing a file to look up employees info and to have the ability to add that info by clicking the option " Edit ". To complete that I am using a text box named "ID" that would find the ID value of the employee (which is a random number) and will give me the ability to edit the info.

    This is the code I am using...

    Somehow it seems that I have disabled the text box ID and it is not pulling up any results. I need help... Attached the file for reference

    Private Sub cmdEdit_Click()
    'error handler
    On Error GoTo cmdEdit_Click_Error
    'check that there is data to edit
    If Me.txtID = "" Then
    Call MsgBox("The fields are not complete", vbInformation, "Edit Contact")
    Exit Sub
    End If
    'find the value in case of duplicates we use an ID
    Set findvalue = Sheet1.Range("n8:n10000").Find(what:=Me.txtID, LookIn:=xlValues)
    'findvalue.Value = Me.txtID "we do not want to edit the ID"
    findvalue.Offset(0, -1).Value = Me.txtEmail.Value
    findvalue.Offset(0, -2).Value = Me.txtAddress.Value
    findvalue.Offset(0, -3).Value = Me.txtNeigborhood.Value
    findvalue.Offset(0, -4).Value = Me.txtPhone.Value
    findvalue.Offset(0, -5).Value = Me.txtSupervisor.Value
    findvalue.Offset(0, -6).Value = Me.txtNTlogin.Value
    findvalue.Offset(0, -7).Value = Me.txtOperatorID.Value
    findvalue.Offset(0, -8).Value = Me.txtContractorID.Value
    findvalue.Offset(0, -9).Value = Me.txtAvayaID.Value
    findvalue.Offset(0, -10).Value = Me.txtEmployeeID.Value
    findvalue.Offset(0, -11).Value = Me.txtFirstName.Value
    findvalue.Offset(0, -12).Value = Me.txtLastName.Value
    Call MsgBox("The contact has been updated", vbInformation, "Edit Contact")

    'reset error
    On Error GoTo 0
    Exit Sub
    'if error occurs then show me exactly where the error occurs
    cmdEdit_Click_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdEdit_Click of Form PhoneList"
    End Sub
    Attached Files Attached Files

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

    Re: Text Box not working in userform

    The Operator ID textbox is named txtOperatorID not txtID.

    txtID appears to refer to a disabled, 'hidden' textbox below all the other controls in the centre of the form.
    If posting code please use code tags, see here.

  3. #3
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: Text Box not working in userform

    Replace
    Please Login or Register  to view this content.
    With
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-24-2016
    Location
    Nicaragua
    MS-Off Ver
    2016
    Posts
    40

    Re: Text Box not working in userform

    Thank you for your responses...

    The "Operator ID" is a different text box than the "ID" one. The column "N" is the one that contains the company ID for each employee and it should be placed in the bottom part of the userform

  5. #5
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: Text Box not working in userform

    Then where is txtID?

  6. #6
    Registered User
    Join Date
    03-24-2016
    Location
    Nicaragua
    MS-Off Ver
    2016
    Posts
    40

    Re: Text Box not working in userform

    Here you have the file edited so that it shows.
    It is the red box showing at the bottom of the userform. What it should do is to return the number assigned in the column "N" of the database sheet for the employee.

    For example if I search for Acevedo, Osiris the number 1 should show in that text box

    Thank you for your help
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: Text Box not working in userform

    You didn't declare the source of txtID anywhere in your macros.

  8. #8
    Registered User
    Join Date
    03-24-2016
    Location
    Nicaragua
    MS-Off Ver
    2016
    Posts
    40

    Re: Text Box not working in userform

    What should be the best way to fix that # sanram?

  9. #9
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: Text Box not working in userform

    You need some adjustment to do this.

    1. Press Ctrl+F3. Then click on outdata and change the 12 to 13 on formula at the end.

    2. Now go to Private Sub ListBox1_DblClick(). Then write
    Please Login or Register  to view this content.
    after
    Please Login or Register  to view this content.
    That's it. Your macro will work then I think.

  10. #10
    Registered User
    Join Date
    03-24-2016
    Location
    Nicaragua
    MS-Off Ver
    2016
    Posts
    40

    Re: Text Box not working in userform

    It actually did

    Thank you

  11. #11
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: Text Box not working in userform

    Glad to hear that it did.

+ 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. [SOLVED] How to get information from Userform compiled to a Userform Text Box?
    By aabo1321 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-10-2015, 06:56 AM
  2. [SOLVED] Chart on Userform - not working
    By Lukael in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-09-2014, 02:54 PM
  3. Why Isn't My Userform Working?
    By drsadistic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-27-2014, 11:18 PM
  4. [SOLVED] Userform: How do I use text/values from a spreadsheet to customize the userform?
    By bananajelly in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-14-2014, 03:47 PM
  5. [SOLVED] Gradually Fade Userform Into View [Userform Fade Out Working Already]
    By nadstradamus in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-05-2013, 04:12 AM
  6. Alt+Tab not working when an userform is opened
    By sivdin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-28-2009, 06:34 AM
  7. Userform.Hide not working
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-15-2005, 10:06 AM

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