wedd
01-05-2012, 09:51 AM
Hi, experts!
Is there part of my code I can change to search for a specific record on my form? At the moment when the user enters the a number it takes through a series of next steps; I would prefer if the user just enters in the ID number and it automatically displays the record rather than going through several steps to get to that record. Can this be done, if so please advise me? My code is listed below. I am a beginner/intermediate user of vba access.
Thanks for your contributions :friends:
Private Sub Text313_AfterUpdate()
If (txtGoTo & vbNullString) = vbNullString Then Exit Sub
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "[CustomerID]=" & txt313
If rs.NoMatch Then
MsgBox "Sorry, no such record exists '" & txtGoTo & "' was found.", _
vbOKOnly + vbInformation
Else
Me.Recordset.Bookmark = rs.Bookmark
End If
rs.Close
txtGoTo = Null
End Sub
Is there part of my code I can change to search for a specific record on my form? At the moment when the user enters the a number it takes through a series of next steps; I would prefer if the user just enters in the ID number and it automatically displays the record rather than going through several steps to get to that record. Can this be done, if so please advise me? My code is listed below. I am a beginner/intermediate user of vba access.
Thanks for your contributions :friends:
Private Sub Text313_AfterUpdate()
If (txtGoTo & vbNullString) = vbNullString Then Exit Sub
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "[CustomerID]=" & txt313
If rs.NoMatch Then
MsgBox "Sorry, no such record exists '" & txtGoTo & "' was found.", _
vbOKOnly + vbInformation
Else
Me.Recordset.Bookmark = rs.Bookmark
End If
rs.Close
txtGoTo = Null
End Sub