kbsudhir
12-17-2008, 07:16 AM
Hi All
I am writing teh below query to get data from my access database using VBA
rs2.Open "SELECT LeavePlanner.Name FROM LeavePlanner WHERE (((LeavePlanner.Name)='" & CSname & "') AND ((LeavePlanner.LeavesStartDate)<=#Date()#) AND ((Format([LeavesStartDate],'" & m & "'))=Format(#Date()#,'" & m & "'))) GROUP BY LeavePlanner.Name;", cn, adOpenStatic, adLockReadOnly
But when this code is executed I am getting an error:
Runtime error '91':
Object variable or with block variable is not set.
PLease guide what am i doing wrong in this line of code.
Thanks
Sudhir
I am writing teh below query to get data from my access database using VBA
rs2.Open "SELECT LeavePlanner.Name FROM LeavePlanner WHERE (((LeavePlanner.Name)='" & CSname & "') AND ((LeavePlanner.LeavesStartDate)<=#Date()#) AND ((Format([LeavesStartDate],'" & m & "'))=Format(#Date()#,'" & m & "'))) GROUP BY LeavePlanner.Name;", cn, adOpenStatic, adLockReadOnly
But when this code is executed I am getting an error:
Runtime error '91':
Object variable or with block variable is not set.
PLease guide what am i doing wrong in this line of code.
Thanks
Sudhir