Question : Error 3001 in Excel VBA with MySQL - Query runs fine in MySQL

Hi Everyone,

    I'm trying to run this query within Excel VBA and it gets an error 3001 "Arguments are of the wrong type, are out of acceptable range, or in conflict with one another."  However the query works fine within MySQL Query...  

I just thought it might be the way I'm connectiong to MySQL from VBA.  I'm using the 2.8 MS and the connection string is .  strSQL is not dimmed at all (I know it probably should be).
Set rs = New ADODB.Recordset
rs.Open strSQL, consqldb, adOpenStatic
1:
select sum(avg100ll) as sumav, sum(jeta1) as sumjet, sum(ipsamt) as ipsamt, location, year(properdate) as year from ars2.tickets where arsid = 'XXXX' group by year(properdate), location order by location;

Answer : Error 3001 in Excel VBA with MySQL - Query runs fine in MySQL

This is due to the recordset
Set rs = Server.CreateObject("ADODB.Recordset")
objrs.CursorType = 2 ' Use 2 instead of adCmdTable
objrs.LockType = 3 ' Use 3 instead of adLockOptimistic
rs.Open strSQL, consqldb

and consqldb should be valid connection string
Or use the following
rs.Open strSQL, consqldb,2,3
Random Solutions  
 
programming4us programming4us