Hello,
Code:
Private Sub searchTXT_KeyDown(KeyCode As Integer, Shift As Integer)
Dim rs As Object
Dim lngBookmark As String
Select Case KeyCode
Case vbKeyReturn
lngBookmark = searchTXT.Value
DoCmd.OpenForm "updatedformTenant"
Set rs = Forms!updatedformTenant.RecordsetClone
rs.FindFirst "Last1 = '" & lngBookmark & "'"
If rs.NoMatch Then
DoCmd.GoToRecord acForm, "updatedformTenant", acNewRec
Else
Forms!updatedformTenant.Bookmark = rs.Bookmark
End If
Set rs = Nothing
KeyCode = 0
End Select
End Sub
I am attempting to run this code when the user hits the enter key. For some reason lngBookMark = serachTXT.Value is giving me an Improper use of NULL exception. Any ideas?