Form shows #Name and #Error on last line ACCESS 2010

Sandra Smith
Sandra Smith used Ask the Experts™
I have an inherited form that I am updating.  The query behind the form is changed in code, but is a simple select.  However, on the form, when the records display, the very last record has #Name in the first field and Error in a few others.  It returns the filtered records, but always with this last line and not sure how to get rid of it.  Attached is a screen shot and below is the code.

Private Sub cboProgram_AfterUpdate()
On Error GoTo ErrorHandler
    Dim strProgram As String
    Dim strSelect As String

strSelect = "SELECT [FirstName] & ' ' & [LastName] AS Fullname, tblPersonProgramHistory.* " & _
                "FROM tblPerson INNER JOIN tblPersonProgramHistory ON tblPerson.PersonID = tblPersonProgramHistory.PersonID "

    If Not IsNull(Me.cboProgram) And Me.cboProgram <> "<All>" Then
            strProgram = Me.cboProgram.Column(0)
            strSelect = strSelect & " WHERE Program = '" & strProgram & "' "
            Me.RecordSource = strSelect
    ElseIf Me.cboProgram = "<All>" Then
            Me.RecordSource = strSelect
    End If

    Exit Sub
    MsgBox "Error Number: " & Err.Number & " Description: " & Err.Description
    Resume Exit_ErrorHandler
End Sub
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
This line is used for adding new records to your dataset. If you don't like to add new data, you can disable additions on form's properties:
Sandra SmithRetired


It worked, thank you.  I just have never had this problem before.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial