Things worked fine after assigning count.
Now things are a bit different, recordset moves only once and it comes to end of file!!!!!!(Really bugs me)
Question is
how can i move to the next group record where next other party record exist for insertion.
set rs3 = new adodb.recordset
Set RS5 = New ADODB.Recordset
rs3.Open "select * from dChallan order by dParty_id ASC,dChallan_date ASC", cn, adOpenDynamic, adLockOptimistic, adCmdText
RS5.Open "InvMaster", cn, adOpenDynamic, adLockOptimistic, adCmdTable
rs3.MoveFirst
Do While Not rs3.EOF
vParty_id = Trim(rs3!dParty_id)
vSiteId = rs3!dsite
If rs3!dParty_id = vParty_id And rs3!dsite = vSiteId Then
strSQL = "SELECT dChallan.dparty_id, dChallan.dsite, Count(*) AS vCount"
strSQL = strSQL & " From dChallan, sites"
strSQL = strSQL & " Where (((dChallan.dsite) = [sites].[sid] and "
strSQL = strSQL & " dChallan.dParty_Id = '" & vParty_id & "' And dChallan.dSite = '" & vSiteId & "' ))"
strSQL = strSQL & " GROUP BY dChallan.dParty_id, dChallan.dSite"
strSQL = strSQL & " HAVING (((Count(*))>=1));"
Set rs3 = cn.Execute(strSQL)
vCount = rs3.Fields("vCount"

.Value
strInsert = "insert into invMaster (InvNo, InvDate, CustCode, Site)"
strInsert = strInsert & " Values ('" & vInvNo & "','"
strInsert = strInsert & EndDate & "','"
strInsert = strInsert & vParty_id & "','"
strInsert = strInsert & vSiteId &"

"
cn.Execute (strInsert)
vInvNo = vInvNo + 1
If rs3.EOF = True Then
Exit Do
End If
End If
[red] 'Here the rs3 comes to eof after the below command which is not supposed
to do
rs3.MoveNext
[/red]
Loop