Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search and seek 1

Status
Not open for further replies.

Bob500

Technical User
Aug 8, 2003
65
EU
Hi,

ipcisID is the priomary key of the table I am searching, I have a combobox that allows the user to input the ipcidID and it then goes to that record.

I have this code on an onclick event of a combo box:

Sub Combo38_AfterUpdate()

Dim strSearch As String, rsCL As DAO.Recordset
strSearch = Me.Combo38
Set rsCL = Forms!frmmain.Form.RecordsetClone
rsCL.FindFirst "[ipcisID] = '" & strSearch & "'"
Forms!frmmain.Form.Bookmark = rsCL.Bookmark

End Sub

How can I make it say "no ipcisID found" if an entry is entered that does not exist, and I also need to prevent it from crashing if a null entry is input.

Many thanks :)
 
Dim strSearch As String, rsCL As DAO.Recordset

If Len (Me.Combo38 & "") > 0 Then
strSearch = Me.Combo38
Set rsCL = Forms!frmmain.Form.RecordsetClone
rsCL.FindFirst "[ipcisID] = '" & strSearch & "'"
If rsCL.NoMatch Then
MsgBox "No ipcisid found for " & strSearch, vbInformation
Else
Forms!frmmain.Form.Bookmark = rsCL.Bookmark
End If
Else
MsgBox "No ipcisid entry entered to find", vbInformation
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top