I'm trying to get the sqltext query below in a format that VB will accept, it is coded on a button in access. When I type it in, with all quotes around it along with the " & _ things, I still get errors. I'm wondering if i'm missing something because of the internal parentheses. Please help. here is the query. I've taken out all of the quotes and other connotations that didn't help.
thanks in advance.
[code=vb]Dim sqltext As String
sqltext = select * from " & _
(Select type,shortname as Ward, abbrev,email,sc hedule.rotation , schedule.acyear , dbo.idtoname(sc hedule.eid) name, schedule.eid , min(startdate) start, " & _
sum(DateDiff(d, startdate, enddate) + 1) As nodays " &_
from schedule, serviceward, employee " & _
where schedule.srvcod e = serviceward.srv code
and schedule.eid = employee.eid
and hosp='U' and type=1 and schedprt=1
and acyear = " & Me.CbxAcyear" and rotation between " & Me.cbxMonth" -1 and " & Me.CbxMonth" and stfgroup=1
Group by type, shortname, schedule.eid, email, schedule.rotati on, schedule.acyear , abbrev
) A
where nodays >= 10
and datepart(ww,sta rt) = datepart(ww,get date())+1[/code]
thanks in advance.
[code=vb]Dim sqltext As String
sqltext = select * from " & _
(Select type,shortname as Ward, abbrev,email,sc hedule.rotation , schedule.acyear , dbo.idtoname(sc hedule.eid) name, schedule.eid , min(startdate) start, " & _
sum(DateDiff(d, startdate, enddate) + 1) As nodays " &_
from schedule, serviceward, employee " & _
where schedule.srvcod e = serviceward.srv code
and schedule.eid = employee.eid
and hosp='U' and type=1 and schedprt=1
and acyear = " & Me.CbxAcyear" and rotation between " & Me.cbxMonth" -1 and " & Me.CbxMonth" and stfgroup=1
Group by type, shortname, schedule.eid, email, schedule.rotati on, schedule.acyear , abbrev
) A
where nodays >= 10
and datepart(ww,sta rt) = datepart(ww,get date())+1[/code]
Comment