Avatar of J.R. Sitman
J.R. Sitman
Flag for United States of America

asked on 

Microsoft Access combo box help

I have a combo box that searches for a number in field orignumber.   I copied the code from another combo box and it works fine, except after it finds the data the combo box keeps the number that was searched for.   I want the number to clear after it is found.   The combo box I copied the code from clears.  Code is below for the new CBO

Private Sub cboOrigNumber_AfterUpdate()
' Comments  : Find the record for the selected SoftSlip
    ' Parameters:
    ' Created   : 09/20/04 18:00 JWV
    ' Modified  :
    '
    ' --------------------------------------------------

    'TVCodeTools ErrorEnablerStart
    On Error GoTo PROC_ERR
    'TVCodeTools ErrorEnablerEnd

    Dim rs As DAO.Recordset
    Me.Filter = ""
    Me.FilterOn = False
    Me.cmdUnfilter.Visible = False
   
    Set rs = Me.RecordsetClone
    rs.FindFirst "[OrigNumber] = '" & Me.cboOrigNumber & "'"
    If Not rs.NoMatch Then
        Me.Bookmark = rs.Bookmark
    Else
        MsgBox "Orig. Number not found!"
        DoCmd.GoToRecord acDataForm, "frmSoftSlips", acFirst
    End If
    'TVCodeTools ErrorHandlerStart
PROC_EXIT:
    Exit Sub

PROC_ERR:
    MsgBox "Error " & Err.Number & _
    " in Form_frmSoftSlips.cboOrigNumber_AfterUpdate:" & vbCrLf & Err.Description
    Resume PROC_EXIT
    'TVCodeTools ErrorHandlerEnd
End Sub
Microsoft AccessVisual Basic Classic

Avatar of undefined
Last Comment
J.R. Sitman

8/22/2022 - Mon