View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ukp9999 ukp9999 is offline
external usenet poster
 
Posts: 1
Default VBA excel - problem with having clause in sql with adodb.connection/recordset


Hi

i need a help on the following error

i am getting error in VBA excel when i am using having clause in the
sql.
i used adodb.connection and adodb.recordset.

my problem is, i need to check duplicates in the oracle table.
so i used the sql statement as follows

select count(*) from table-1
having count(*) 1
group by field-1,field-2,field-3.

and string the count in a variable.

var-1 = rs.fields(0).

when i execute that i am getting error as runtime error : 3021
and here is the description

" Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires current record"

here is my code

strsql = "select name,product,product_number,begin_date,end_date from
product_lisence_info" _
& " having count(*) 1 " _
& " group by
name,product,product_number,begin_date,end_date "


rs1.Open strsql, con1, adOpenKeyset

dupli = rs1.Fields(0)


rs1.close


thanks

Kiran


--
ukp9999
------------------------------------------------------------------------
ukp9999's Profile: http://www.excelforum.com/member.php...o&userid=28853
View this thread: http://www.excelforum.com/showthread...hreadid=486019