ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,832
- Office Version
- 2007
- Platform
- Windows
Hi,
Spent ages looking for an issue of which ive now sorted so because of that i wish to move/edit the array from its module hiding place to the sheet itself.
Here is the code on the sheet.
In the above code the line in Red calls a module.
Im looking to have the code on the sheet & not the module.
Please advise so i can take it from there.
Spent ages looking for an issue of which ive now sorted so because of that i wish to move/edit the array from its module hiding place to the sheet itself.
Here is the code on the sheet.
Rich (BB 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
In the above code the line in Red calls a module.
Rich (BB code):
Function ControlNames() As Variant
ControlNames = Array("txtCustomer", "txtRegistrationNumber", "txtBlankUsed", "txtVehicle", _
"txtButtons", "txtKeySupplied", "txtTransponderChip", "txtJobAction", _
"txtProgrammerCloner", "txtKeyCode", "txtBiting", "txtChassisNumber", _
"txtJobDate", "txtVehicleYear", "txtPaid", "txtInvoiceNumber", "txtNotes", _
"txt1Address", "txt2Address", "txt3Address", "txt4Address", "txtPostCode", _
"txtTelNumber", "txtSecurityCode", "txtManual", "txtInfo", "txtSupplier", "txtPartNumber", "txtPaymentType", "txtPinCode")
End Function
Im looking to have the code on the sheet & not the module.
Please advise so i can take it from there.