Hi,
I have the following code. I keep getting Type Mismatch. I have tried numerous solutions but can't get it to work. Suggests???
Thanks,
Jackie
Dim dbs As Database
Dim rs As Recordset
Dim selpart As String
Dim selfrom As String
Dim selhave As String
Dim ssql As String
Set dbs = DBEngine.Workspaces(0).Databases(0)
curyr = CStr(Right(Year(Date), 2))
selpart = "SELECT Count(Left([companies]![coid],2)) AS totyr, Left([companies]![coid],2) AS yr"
'selpart = "select coid AS yr"
selfrom = " FROM companies GROUP BY Left([companies]![coid],2)"
selhave = " having (((Left([companies]![coid],2))='" & curyr & "'));"
ssql = selpart & selfrom & selhave
set rs = dbs.OpenRecordset(ssql)
Minggu, 01 Juli 2012
[MS_AccessPros] help with coded select
__._,_.___
.
__,_._,___
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar