|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I am querying tables by the user entering a code into a text box in a form. An append query then uses the value entered to search a table and append any matching results into a new table. This new table is then shown as a new form. Rather than displaying an empty form when no matching results are found I want an error message to be displayed. How can I check if there are any matching records and display an error message if needed? Thanks |
|
#2
|
|||
|
|||
|
Hi,
One of the way to do this is to check the param called @@ROWCOUNT which stores the value of the rows affected by your last sql query. E.g. @@ROWCOUNT = 0. 0 means no matching result from the search. You can get more information on the usage of @@ROWCOUNT in SQL book online. All the best! |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > Empty Query Result Error Message |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|