SP and RecordSource: Testing for empty results?

  • Thread starter Thread starter spoono
  • Start date Start date
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
 
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 &
 
Back
Top