i am having a problem with access sql SELECT statement. the problem is that when the backend is ACCESS-2007 it works; however when the backend is sql-server-2008, it is not returning anything. here is the statement:
SELECT IIf([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)] Like '*1.11*Other*','1.11 Other',[Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]) AS [Occurrence Code], Count([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]) AS [Count]
FROM [Lab Occurrence Form]
WHERE ((([Lab Occurrence Form].[Occurrence Date]) Between Forms!Meeting_Reasons_Frequency!Text4 And Forms!Meeting_Reasons_Frequency!Text2 )) And [Lab Occurrence Form].[1 0 Preanalytical (Before Testing)] Like '*1.*'
GROUP BY IIf([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)] Like '*1.11*Other*','1.11 Other',[Lab Occurrence Form].[1 0 Preanalytical (Before Testing)])
HAVING ((Count([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]))<>0)
ORDER BY IIf([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)] Like '*1.11*Other*','1.11 Other',[Lab Occurrence Form].[1 0 Preanalytical (Before Testing)])
please note that what is not working is this: Forms!Meeting_Reasons_Frequency!Text4
and this Forms!Meeting_Reasons_Frequency!Text2
- when i replace those with constant values they work; however the trouble is that it they are not reading correctly what is in the textbox for some reason.
again: this query is working FINE with access as a backend, however when the backend switches to sql server it is not working! the reason again is because of the forms!text
thing. does anyone know why?
update thanks to bob's suggestion i ran profile on sql-server and found something funny. it is indeed working correctly, however it is returning the date like this:
@P1 datetime,@P2 datetime','2010-04-30 00:00:00','2010-04-01 00:00:00'