run time error

if (custTable.PaymTermId)//always execute for mandatory
{
while select InvoiceDate from cust order by cust.InvoiceDate desc where cust.OrderAccount == custTable.AccountNum
{
i++;
if(cust.InvoiceDate == datenull())
{
return true;
}
if(i==2)
{
// select InvoiceDate from cust order by cust.InvoiceDate desc where cust.OrderAccount == custTable.AccountNum;
if (cust.InvoiceDate )
{
a=cust.InvoiceDate;

what is wrong in this lines…

if i run these code in job its working, but in class(cust credit limit) i wrote one method called chkdate in tat its not working, if , date already existing means its working fine, if the date is empty means, its not working…

pls any one help me…

thanx in advance…

What is happening if you dont have the date? I cannot comment on the code as the intension of it is unknown…

if no date means, its not processing anything… just same… for eg if am clicking the post menu menu means it doesnt process,

but its not return any error or warning and i can click the post menu again n again…

I don’t understand…please explain in better detail.