Textbox on userform not updating when navigating through records

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,596
Office Version
  1. 2007
Platform
  1. Windows
Morning.
I have a userform where the Textboxes show values for that customer from my worksheet.
I have a command button which is a navigation for the next customer.
Each time i press the command button the next customer is shown & the Textboxes are updated to show the correct values for that customer in question.

I have now added another Textbox for Payment Type
The Textbox in question is Textbox11 & is in column AC

My issue is when i navigate through my customers this new Textbox isnt updating the value like the others.

Does anything spring to mind as i dont see in the code anything out of place & i have changed AB to AC to reflect the new column on my worksheet
This is the code for the Textboxes.

VBA Code:
    Me.TextBox1.Value = ws.Range("Q" & rw).Value
    Me.TextBox2.Value = ws.Range("R" & rw).Value
    Me.TextBox3.Value = ws.Range("S" & rw).Value
    Me.TextBox4.Value = ws.Range("T" & rw).Value
    Me.TextBox5.Value = ws.Range("U" & rw).Value
    Me.TextBox6.Value = ws.Range("V" & rw).Value
    Me.TextBox7.Value = ws.Range("W" & rw).Text
    Me.TextBox11.Value = ws.Range("AC" & rw).Text

On my worksheet i double click the customers name,the userform opens & i see all the Textboxes with all the values shown.
Textbox11 of which is payment type shows CASH as that was the way this customer paid.

Lets just say all the other customers in my database paid using via BANK
So on the userform pressing the command button shws the next customers records.
Textbox11 should now be showing BANK but it still shows CASH

I continue to press the command button loading each customer BUT the value still shows CASH

Below is the navigate code.
Code:
Sub Navigate(ByVal Direction As XlSearchDirection)
    Dim i As Integer
    Dim lastRow As Long
    
    lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
    
    r = IIf(Direction = xlPrevious, r - 1, r + xlNext)
    
    'ensure value of r stays within data range
    If r < startRow Then r = startRow
    If r > lastRow Then r = lastRow
    
    'get record
    For i = 1 To UBound(ControlNames)
         Me.Controls(ControlNames(i)).Text = IIf(Direction = xlNone, "", ws.Cells(r, i).Text)
        
    Next i
    
    Me.Caption = "Database"
    
    'set enabled status of next previous buttons
    Me.NextRecord.Enabled = IIf(Direction = xlNone, False, r < lastRow)
    Me.PrevRecord.Enabled = IIf(Direction = xlNone, False, r > startRow)
    
    EventsEnable = False
    Me.ComboBoxCustomersNames.ListIndex = IIf(Direction = xlNone, -1, r - startRow)
    EventsEnable = True


End Sub
 
I will start a new post as would need some help to get me started.
Thanks
 
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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