• 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.

Problem to display information in TextBox

Fred Wayne

Member
Hello. I made this little VBA project to search working extensions of the place where I work. My project has 4 Texboxes to display the results of the name I am looking for. I don´t know why for any reason, I can not make the last Textbox called "DID" to display the information as the other 3(Name, Additional information, and Extension). Besides that, the buttons “New” and “Edit” give me a little wrong message that says “Run-Time error ‘1004’: Method ‘Range’ of Object ‘Global failed’. This happens every time I enter new information or edit information that is already in the project. Can you help me with that please? The file is already attached for you to take a glance at it. Thank you very much.

Sincerely yours,

Fred.
 

Attachments

  • Phone Book by Department.xlsm
    106.9 KB · Views: 4
  • Error on NEW Button.PNG
    Error on NEW Button.PNG
    33.8 KB · Views: 11
  • TextBox .png
    TextBox .png
    119.6 KB · Views: 11
This addresses only what you've asked.

I don´t know why for any reason, I can not make the last Textbox called "DID" to display the information
you 're only looping through the first 3 columns of the listbox and it needs to be 4, and your textbox names are not sequential.
Try this
Code:
Private Sub LB_00_Click()
' the LISTBOX
  For I = 0 To 3
    If I < 3 Then
        Me("T_0" & I) = LB_00.Column(I)
    Else
        Me("T_0" & I + 1) = LB_00.Column(I)
    End If
  Next
  Cmd_00.Enabled = False
  Cmd_01.Enabled = True
End Sub

The buttons...
need the resize to be 4, and the additional textbox added to the array
Code:
Private Sub Cmd_00_Click()
' NEW button
Sheets("AGENDA").ListObjects(1).ListRows.Add.Range.Resize(, 4).Value = Array(T_00.Value, T_01.Value, T_02.Value, T_04.Value)
    AZsort
    reset
End Sub
Code:
Private Sub Cmd_01_Click()
' EDIT button
Sheets("AGENDA").ListObjects(1).DataBodyRange.Cells(LB_00.ListIndex + 1, 1).Resize(, 4).Value = Array(T_00.Value, T_01.Value, T_02.Value, T_04)
    reset
End Sub

The error message...
is from the AZsort sub because it should be Table1 not Table9
 
Hello. I haven't had time to check well. I was at hospital at that time. Please accept my apologies. I haven't touched the file yet. You are the best. Thanks so much. Once again, I do really feel so ashamed with you. From the bottom of my heart, please accept my truly apologies.
 
Back
Top