I have a form that is being use to update a file, I placed an unbound control on it and will use this to look for the record to update. It founds the record if it is there fine, but if nomatch I want it to ret to the seach field. I put this code in the afterupdate event of the search field
Private Sub List48_AfterUpdate()
On Error GoTo Err_Go_To_List48_AfterUpdate
' Find the record that matches the control.
Dim rs As Object
Dim ctl As Control
Set ctl = Forms![Postage Stamp Log Return]!List48
Set rs = Me.Recordset.Clone
rs.FindFirst "[Roll Number] = " & Str(Me![List48])
If rs.NoMatch Then
Me.Bookmark = rs.Bookmark
Forms![Postage Stamp Log Return]!List48.SetFocus
MsgBox "No entry found"
Exit Sub
Else
Me.Bookmark = rs.Bookmark
[Qty Returened].SetFocus
Exit Sub
End If
Exit_Go_To_List48_AfterUdate:
Exit Sub
Err_Go_To_List48_AfterUpdate:
MsgBox Err.Description
Resume Exit_Go_To_List48_AfterUdate
End Sub
it is not working, It was working sometime, but the more I fool around with it the worst it get. Could someone please help me.
Thanks
Private Sub List48_AfterUpdate()
On Error GoTo Err_Go_To_List48_AfterUpdate
' Find the record that matches the control.
Dim rs As Object
Dim ctl As Control
Set ctl = Forms![Postage Stamp Log Return]!List48
Set rs = Me.Recordset.Clone
rs.FindFirst "[Roll Number] = " & Str(Me![List48])
If rs.NoMatch Then
Me.Bookmark = rs.Bookmark
Forms![Postage Stamp Log Return]!List48.SetFocus
MsgBox "No entry found"
Exit Sub
Else
Me.Bookmark = rs.Bookmark
[Qty Returened].SetFocus
Exit Sub
End If
Exit_Go_To_List48_AfterUdate:
Exit Sub
Err_Go_To_List48_AfterUpdate:
MsgBox Err.Description
Resume Exit_Go_To_List48_AfterUdate
End Sub
it is not working, It was working sometime, but the more I fool around with it the worst it get. Could someone please help me.
Thanks