SP and RecordSource: Testing for empty results?

S

spoono

Hi

I have an ADP that sets the bound forms Recordsource to the results of
a stored procedure. The code in VBA I have that sets the forms
recordsource
is:

[Forms]![frmData].RecordSource = "EXEC usp_SelectSubSet3 " & strCrit &
"," & strSearch

This is all cool until the SP doesn't return any results i.e The
search criteria didn't find any matches. The form freaks out because
it's RecordSource is empty.

Anyone have any ideas with code on how I can test to see if the Stored
Procedure returns any rows before I set the forms Recordsource to the
results of the SP?

thanks
Simon
 
S

Sapphire

Hi,

Goto to your Sql Suery Analyser and run the query and see
if any records are returned for ...

"EXEC usp_SelectSubSet3 " & strCrit &
"," & strSearch

e.g Exec usp_SelectSubset3 'test', 'test'... If there are
results then they will come back to the form record
source.

Other possible issues: Is your code passing the correct
Sql query? For e. g. 'test' is the correct way not just
test without the single quotes... please verify.

Hope this helps



-----Original Message-----
Hi

I have an ADP that sets the bound forms Recordsource to the results of
a stored procedure. The code in VBA I have that sets the forms
recordsource
is:

[Forms]![frmData].RecordSource = "EXEC
usp_SelectSubSet3 " & strCrit &
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top