Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3276578
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:16:25+00:00 2026-05-17T19:16:25+00:00

i am having a problem with access sql SELECT statement. the problem is that

  • 0

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'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:16:25+00:00Added an answer on May 17, 2026 at 7:16 pm

    Try defining your form control references as parameters:

      PARAMETERS [Forms]![Meeting_Reasons_Frequency]![Text4] DateTime, 
         [Forms]![Meeting_Reasons_Frequency]![Text2] DateTime;
      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)])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm having a problem running an sql in ms-access. im using this code: SELECT
We are having a serious problem with a query that defies explanation. In SQL-plus
I am having a problem with inserting new data into MS Access 2007 file.
I've had a big problem in replicating a simple SQL Server 2008 R2 Express
I am having an odd problem with my SQL Server express 2005 DB. It
Recently, I've started having a problem with my SQL Server 2005 client running on
I am using EntityFramework 4 to access a SQL Server 2008 database. One of
I'm having some trouble trying to get Microsoft Access 2007 to accept my SQL
I’m having a problem with my SQL Connection strings not using the authentication provided
I’m having a problem with a linked Informix table in MS SQL Server 2008r2.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.