Hi
In my Excel user form Initialize procedure I get the data row I require from a table "Organisation" and I am trying to fill certain textboxes on the form from the selected row, but the form is not showing all the data.
The procedure is selecting the correct table row, my problem is in the section where the user is selecting an existing Organisation, everything is working except the area between the hash lines.
In my Excel user form Initialize procedure I get the data row I require from a table "Organisation" and I am trying to fill certain textboxes on the form from the selected row, but the form is not showing all the data.
The procedure is selecting the correct table row, my problem is in the section where the user is selecting an existing Organisation, everything is working except the area between the hash lines.
VBA Code:
Private Sub UserForm_Initialize()
Dim ws As Worksheet
Set ws = Sheets("Organisation")
ws.Activate
' Check if it's a new organisation or the user is searching for an organisation
Call DisableAllButtons
If var.searchOrganisation Then
'User is selecting an organisation
var.rowNum = GetRowNumber("Organisation", var.txtId, 1)
If var.rowNum <> 0 Then
'#################################################
txtId.Text = Cells(var.rowNum, 1).Text
txtOrganisationName.Text = Cells(var.rowNum, 2).Text
txtAddressLine1.Text = Cells(var.rowNum, 3).Text
txtAddressLine2.Text = Cells(var.rowNum, 4).Text
txtCity.Text = Cells(var.rowNum, 5).Text
txtCounty.Text = Cells(var.rowNum, 6).Text
txtPostcode.Text = Cells(var.rowNum, 7).Text
txtCountry.Text = Cells(var.rowNum, 8).Text
txtTelephone.Text = Cells(var.rowNum, 9).Text
txtMobile.Text = Cells(var.rowNum, 10).Text
txtFax.Text = Cells(var.rowNum, 11).Text
txteMail.Text = Cells(var.rowNum, 12).Text
txtWebSite.Text = Cells(var.rowNum, 13).Text
txtNotes.Text = Cells(var.rowNum, 14).Text
'###############################################
End If
btnDeleteOrganisation.Enabled = True
btnSaveOrganisation.Enabled = True
var.searchOrganisation = False
var.txtId = ""
Else
'User is entering a new organisation
Call MaintenanceReset
btnDeleteOrganisation.Enabled = True
btnSaveOrganisation.Enabled = True
End If
End Sub