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!

applyfilter creates a new record when nothing found

Status
Not open for further replies.

bopritchard

Programmer
Jan 27, 2003
199
US
i've got an input box that takes an id and then does an apply filter
IssueID = InputBox("Enter the Issue ID", "Search for Issue")
DoCmd.ApplyFilter , WhereCondition:="id=" & IssueID

problem is...when there isn't a record that matches the filter, my form is inserting one into the table...

i need the trap the fact that there is no matching record
 
Something like this ?
If DCount("*", "[your table name]", "id=" & IssueID) > 0 Then
DoCmd.ApplyFilter , WhereCondition:="id=" & IssueID
Else
MsgBox "Issue not found"
End If

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top