I used to be able to do this in 2003... but it has been a while.
I want a text box at the top of the form that will allow the user to type in an asset# to search the database
I know this is the Me.RecordsetClo ne feature... but for the life of me - it cannot get it to work.... (I think the bold part is the problem... vba autohelp shows this is supposed to be in parens... but that didnt' work either - online i found it encapsulated in "" but i keep getting an error of
Syntax error (missing operator) in expression.
I have a text box at top of form called searching
I have another text box which is called txtAssetID
then the specific fields are on the form that are needed for this view... the searching text box is where I want the user to put the asset# they want to look up.
right now we are using the ctrl+f function to do a search on the active field... but it looks rudamentary...
here is the code i have... any tweaks would be most appreciated!
I want a text box at the top of the form that will allow the user to type in an asset# to search the database
I know this is the Me.RecordsetClo ne feature... but for the life of me - it cannot get it to work.... (I think the bold part is the problem... vba autohelp shows this is supposed to be in parens... but that didnt' work either - online i found it encapsulated in "" but i keep getting an error of
Syntax error (missing operator) in expression.
I have a text box at top of form called searching
I have another text box which is called txtAssetID
then the specific fields are on the form that are needed for this view... the searching text box is where I want the user to put the asset# they want to look up.
right now we are using the ctrl+f function to do a search on the active field... but it looks rudamentary...
here is the code i have... any tweaks would be most appreciated!
Code:
Private Sub txtGoTo_AfterUpdate()
If (txtGoTo & vbNullString) = vbNullString Then Exit Sub
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
[B]rs.FindFirst "[Asset ID]" & "txtAssetID"[/B]
If rs.NoMatch Then
MsgBox "Sorry, no such record '" & txtGoTo & "' was found.", _
vbOKOnly + vbInformation
Else
Me.Recordset.Bookmark = rs.Bookmark
End If
rs.Close
txtGoTo = Null
End Sub
Comment