Error 80004005 when executing query in ADODB (VBA, Excel and Acccess 2010) -


i have problem can not head around. have access database trying create set of queries in using vba in excel use of adodb.

i have several queries created, ie. 1 below here. second not work. if copy query manually access database (from select , forward) , save "dk_teledata_1" works perfect

create procedure dk_aktiviteter_union_1 select dk_aktivitet.År dk_aktivitet; 

and 1 not work

create procedure dk_teledata_1 select dk_teledata.dato dk_teledata inner join time_intervals on dk_teledata.interval = time_intervals.time_interval; 

the following queries same data created without problems:

create procedure dk_teledata_1 select * dk_teledata; create procedure dk_teledata_1 select * time_intervals; create procedure dk_teledata_1 select * time_intervals, dk_teledata; 

as create join or use "where dk_teledata.interval = time_intervals.time_interval" fails.

the fields intervals , time_intervals both text fields same length , properties.

please !

many martin

using excel 2010, accdb database file , "microsoft.ace.oledb.12.0" provider string.

as wild guess, i'll suggest substitute create view create procedure.

if doesn't work, can use dao create query.

dim strsql string dim db dao.database dim qdf dao.querydef  strsql = "select dk_teledata.dato" & vbcrlf & _     "from dk_teledata inner join time_intervals" & vbcrlf & _     "on dk_teledata.interval = time_intervals.time_interval;" set db = opendatabase("c:\db_folder\your.accdb", true, false) set qdf = db.createquerydef("dk_teledata_1", strsql) 

that code uses binding requires setting reference. same thing late binding doesn't require reference.

dim strsql string dim dbe object dim db object dim qdf object  strsql = "select dk_teledata.dato" & vbcrlf & _     "from dk_teledata inner join time_intervals" & vbcrlf & _     "on dk_teledata.interval = time_intervals.time_interval;" set dbe = createobject("dao.dbengine.120") set db = dbe.opendatabase("c:\db_folder\your.accdb", true, false) set qdf = db.createquerydef("dk_teledata_1", strsql) 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -