This topic is locked

How do I know if my List is empty?

4/22/2009 11:25:53 AM
ASPRunnerPro General questions
Stu author

I drill down to a Detail page and before I Add a new detail record I would like to know if this is the FIRST Detail record that will exist when I've added it. ie no currect Detail records.
I need to know this before the Add because I will populate some fields in the Add form with pre-existing data in the most recent record in the List. Of course, if there is no pre-existing record then I must populate with blanks.
(Its like a support forum where if you Add a Reply I automatically take the previous reply as the starting point)
I can now get to the Foreign Key in my Add screen BUT if no record exists yet in the List then It seems to return a blank or null value.
My test for:
If Session("dbo.WebChat_masterkey1")=""
doesn't seem to trap it.
Is there maybe an Isnull or Isempty function I can use.
Regards,
Stu

Sergey Kornilov admin 4/22/2009

You can use events to run SQL query that returns details records.

set rstmp=CustomQuery("select * from DetailsTable where KeyColumn=" & Session(strTableName & "_masterkey1"))

if rstmp.eof then

...

else

...

end if