I have a form for viewing part information
Part#, Serial#, Location, etc.
On the top of the form I have three unbound text boxes labeled txtFindPart, txtFindSer and txtFindLoc.
I have listed the code in the "After Update" event at the bottom of this question.
My problem is when the partno is NOT found, focus DOES NOT return to the txtFindPart as I expect; instead it returns to the textbox AFTER the txtFindPart text box. How do I get it to return to the txtFindPart text box?
Each of the unbound text boxes exhibit the same behaviour - they return to the FOLLOWING text box.
Thank you
------------------
Private Sub txtFindPart_AfterUpdate()
Dim varBookmark As Variant
varBookmark = Me.Bookmark
Me.RecordsetClone.FindFirst "[PartNo] = '" & Me![txtFindPart] & "'"
If Me.RecordsetClone.NoMatch Then
MsgBox "Could not find that part number... please retry"
Me.Bookmark = varBookmark
Me.txtFindPart.SetFocus
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
Me!txtFindPart = Null
End If
End Sub
-----------------
Part#, Serial#, Location, etc.
On the top of the form I have three unbound text boxes labeled txtFindPart, txtFindSer and txtFindLoc.
I have listed the code in the "After Update" event at the bottom of this question.
My problem is when the partno is NOT found, focus DOES NOT return to the txtFindPart as I expect; instead it returns to the textbox AFTER the txtFindPart text box. How do I get it to return to the txtFindPart text box?
Each of the unbound text boxes exhibit the same behaviour - they return to the FOLLOWING text box.
Thank you
------------------
Private Sub txtFindPart_AfterUpdate()
Dim varBookmark As Variant
varBookmark = Me.Bookmark
Me.RecordsetClone.FindFirst "[PartNo] = '" & Me![txtFindPart] & "'"
If Me.RecordsetClone.NoMatch Then
MsgBox "Could not find that part number... please retry"
Me.Bookmark = varBookmark
Me.txtFindPart.SetFocus
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
Me!txtFindPart = Null
End If
End Sub
-----------------