Tempermental form

T

TitaniaTiO2

Thanks in advance

I have a form based on a qry:qryEditEmployeeInformation

SELECT tblPerson.LastName, tblPerson.FirstName, [LastName] & ", " &
[FirstName] AS Expr1, tblPerson.JobTitle, tblPerson.EmploymentStatus,
tblDepartment.Department, tblPerson.PersonID
FROM tblPerson INNER JOIN (tblDepartment INNER JOIN tblEmployment ON
tblDepartment.DepartmentID=tblEmployment.DepartmentID) ON
tblPerson.PersonID=tblEmployment.PersonID
WHERE (tblPerson.PersonID=Forms!frmEditEmployeeInformation!txtPersonID);


On the form I have combo box (cmbEmployeeName) which is set-up with
SELECT qryEmployeeNameLookUp.PersonID, qryEmployeeNameLookUp.Expr1 FROM
qryEmployeeNameLookUp ORDER BY [Expr1];


qryEmployeeNameLookUp
SELECT tblPerson.PersonID, tblPerson.LastName, tblPerson.FirstName,
[LastName] & ", " & [FirstName] AS Expr1
FROM tblPerson;


This combo box lists all the names just fine.

From there I select a name. On the AfterUpdate Feature of this combo box I
have the following:

Private Sub cmbEmployeeName_AfterUpdate()
txtPersonID.SetFocus

txtPersonID = cmbEmployeeName.Column(0)
Debug.Print txtPersonID
Requery
txtFirstName.Visible = True
txtFirstName.Visible = True
txtLastName.Visible = True
txtDepartment.Visible = True
txtEmploymentStatus.Visible = True
txtJobTitle.Visible = True
cmdEditDepartment.Visible = True
cmdEditEmploymentStatus.Visible = True
frmSOPSEmployeeTrainedTo.Visible = True

txtNewEmploymentStatus.Value = ""
txtDepartmentID.Value = 0
End Sub


On some names the text boxes appear and life is great. On certain names it
does not work. Nothing appears. No text boxes. The combo box actually shows
a blank rather then the name. nothign happens. Out of a list of about 70
names there are like 5 that are consistently not working and I have no idea
why. There is nothing in their information that would cause a query to
exclude them.

Any suggestions?


Thanks

Titania
 
J

Jeanette Cunningham

Hi TitaniaTiO2,
as you are using a bound form, I suggest you remove the following 4 lines.

txtPersonID.SetFocus

txtPersonID = cmbEmployeeName.Column(0)
Debug.Print txtPersonID
Requery

the code for the after update of the combo would look like this:

Private Sub cmbEmployeeName_AfterUpdate()

txtFirstName.Visible = True
txtLastName.Visible = True
txtDepartment.Visible = True
txtEmploymentStatus.Visible = True
txtJobTitle.Visible = True
cmdEditDepartment.Visible = True
cmdEditEmploymentStatus.Visible = True
frmSOPSEmployeeTrainedTo.Visible = True
txtNewEmploymentStatus.Value = ""
txtDepartmentID.Value = 0
End Sub


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
Top