Add textbox to userform issue

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,280
Office Version
  1. 2007
Platform
  1. Windows
Hi,
I have a working userform & require a text box just so i can add some brief notes.

I have added the text box to the form ok & written some text into it.
I save it all ok but when i then go back to this customers records on this form i dont see the text that was written ?

My info for all the fields on the userform come from a database,does that mean that the text i wish to see in this text box needs to be entered onto the database also ?

Or if possible i just need to be able to write a line or two & save without the database side of things.

Thanks please advise.
 
It could be best to fill textbox1 when you make a selection from the customer combobox
Code:
Private Sub ComboBoxCustomersNames_Change()
    If Not EventsEnable Then Exit Sub
    'get record
    r = Me.ComboBoxCustomersNames.ListIndex + startRow - 1
    Navigate Direction:=0
    '----------fill textbox1-------------------
    x = Application.VLookup(Me.ComboBoxCustomersNames, Range("A6:Q" & Cells(Rows.Count, "A").End(xlUp).Row), 17, False)
    TextBox1 = x

End Sub
Possibly you can use your search command to fill the q cell again
Code:
    If Me.NewRecord.Caption = "CANCEL" Then
        With Sheets("DATABASE")
            Set C = .Range("A:A").Find(What:=txtCustomer.Value, _
                                       After:=.Range("A5"), _
                                       LookIn:=xlValues, _
                                       LookAt:=xlWhole, _
                                       SearchOrder:=xlByRows, _
                                       SearchDirection:=xlNext, _
                                       MatchCase:=False)
        End With
        If Not C Is Nothing Then
            MsgBox "Customer already Exists, file did not update"
            '-----fill "Q" cell---------
            Cells(C.Row, "Q").Value = TextBox1 '<<<<<<<<<<<<<<
            Exit Sub
        End If
    End If
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi,
Did you try the above as i dont get it to work.

I added the first code & tried then both & tried.

I make a selection from the drop down box,add text & save.
When i check cell Q there is nothing,when i select the same customer from the drop down list the text i wrote is gone.

As you have the file there do you see where the info from my database is being pulled from to be filled into the userform textboxes.
I thought by adding a column Q and putting the text in each correct cell then when i open the userform the textboxes would be filled & even the box we are working on.
 
Upvote 0
Did you download the file i supplied the link for ?

In the database each rows info is for each specific customer.
When the userform is open how do the textboxes know which textbox needs to be filled with the relevant info from the database.

This is the part i cant remember because once that code is found dont we just the say to the code Also include column Q and then have that info shown in the new text box called Notes.
 
Upvote 0
I have been monitoring this thread from the beginning and I will say I'm confused:

First you just mentioned entering Text in a Textbox on a Userform and wanting to see same data in same text box next time you opened userform.

But then you said:
When i then scroll through the customers in the userform i should see the text for each customer be shown.

Scroll thru what ??
You never mentioned a Combobox in your first posting.

I'm confused are we wanting to have just one Textbox and One Combobox on the userform
And when you first open the Userform what text do you expect to see in the Textbox.
 
Upvote 0
Hmmm
Im trying to advise what is required etc but cant advice if you havent downloaded the file.

How do you then see what im working with ?
 
Upvote 0
Hi,
Look in the module called Function Code.
Does that help you ?
 
Upvote 0

Forum statistics

Threads
1,216,496
Messages
6,130,982
Members
449,611
Latest member
Bushra

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