excel vba - SQL Query Automation Error -


i trying run query search data in microsoft access , running bit of problem. error occurs on line

rec.open sqlquery, conn 

and reads "run-time error '-2147217900 (80040e14)': automation error"

sub query21st()     ' create file path reference string 21st data     dbpath = database_path()      ' create connection string     dim connstring string     connstring = "provider=microsoft.ace.oledb.12.0;" & _     "data source=" & dbpath & ";" & _     "persist security info=false;"      'create connection connection string above     dim conn new adodb.connection      conn.open connstring      ' create sql command string     dim lookupfields string     lookupfields = "cert.[avgle]"      dim sqlquery string     sqlquery = "select " & lookupfields & " [certificates] cert " & _     "where [dob] =" & [dob_21st] & " , [certificatedate] =" & [certdate_21st] & " , [mpi1] =" & [mm] & ")"      ' create recordset , data connection     dim rec new adodb.recordset     rec.open sqlquery, conn      [returnrange_21st].clearcontents     [returnrange_21st].cells(1).copyfromrecordset rec       ' close recordset     rec.close      'close connection     conn.close  end sub 

the "database_path" function contains delicate info cannot posted guarantee works fine. appreciated.


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -