J.R. Sitman
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.cboOrigN umber_Afte rUpdate:" & vbCrLf & Err.Description
Resume PROC_EXIT
'TVCodeTools ErrorHandlerEnd
End Sub
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.cboOrigN
Resume PROC_EXIT
'TVCodeTools ErrorHandlerEnd
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER