ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,596
- Office Version
- 2007
- Platform
- 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.
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.
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