Avatar of Sandra Smith
Sandra Smith
Flag for United States of America asked on

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

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
            Me.Requery
    ElseIf Me.cboProgram = "<All>" Then
            Me.RecordSource = strSelect
            Me.Requery
    End If


Exit_ErrorHandler:
    Exit Sub
ErrorHandler:
    MsgBox "Error Number: " & Err.Number & " Description: " & Err.Description
    Resume Exit_ErrorHandler
End Sub
ProgramHistoryError.png
Microsoft AccessVisual Basic Classic

Avatar of undefined
Last Comment
Sandra Smith

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
als315

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Sandra Smith

ASKER
It worked, thank you.  I just have never had this problem before.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes