We help IT Professionals succeed at work.
Get Started

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

54 Views
Last Modified: 2015-09-21
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
Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE