Hi everyone,
I am having an interesting problem with a query and SQL string that hopefully some of you good people can help me with. I'm working on an app that has an MS Access 2002 front end connected to SQL Server 2000 back end. I have a simple query that has 3 fields: Submission ID (text - Primary Key), SectionPositionTitle (Text), ManagerDecision (Integer). In the query I am trying to filter the results by adding criteria to each field like as follows: SubmissionID = SUB_ID on main form, SectionPositionTitle = "DistrictSupervisor", & ManagerDecision = 1. Its fairly simple and works perfectly fine as a stand alone query and returns the correct results. The SQL looks like this:
SELECT dbo_WIP_InternalReview.SubmissionID, dbo_WIP_InternalReview.SectionPostionTitle, dbo_WIP_InternalReview.SectionDecisionID FROM dbo_WIP_InternalReview WHERE (((dbo_WIP_InternalReview.SubmissionID)=[forms]![frmWIPMAIN]![SUB_ID]) AND ((dbo_WIP_InternalReview.SectionPostionTitle)="DistrictSupervisor") AND ((dbo_WIP_InternalReview.SectionDecisionID)=1));
Now, what I want to do is use this SQL in VBA to return a string value but when I try to run the code it errors and highlights this section: ="DistrictSupervisor") and tells me that there has been a compile error Expected: End of Statement.
Any idea why this will run in one situation but not in another?
Any/All help on this is greatly appreciated!
Thanks -Kevin
I am having an interesting problem with a query and SQL string that hopefully some of you good people can help me with. I'm working on an app that has an MS Access 2002 front end connected to SQL Server 2000 back end. I have a simple query that has 3 fields: Submission ID (text - Primary Key), SectionPositionTitle (Text), ManagerDecision (Integer). In the query I am trying to filter the results by adding criteria to each field like as follows: SubmissionID = SUB_ID on main form, SectionPositionTitle = "DistrictSupervisor", & ManagerDecision = 1. Its fairly simple and works perfectly fine as a stand alone query and returns the correct results. The SQL looks like this:
SELECT dbo_WIP_InternalReview.SubmissionID, dbo_WIP_InternalReview.SectionPostionTitle, dbo_WIP_InternalReview.SectionDecisionID FROM dbo_WIP_InternalReview WHERE (((dbo_WIP_InternalReview.SubmissionID)=[forms]![frmWIPMAIN]![SUB_ID]) AND ((dbo_WIP_InternalReview.SectionPostionTitle)="DistrictSupervisor") AND ((dbo_WIP_InternalReview.SectionDecisionID)=1));
Now, what I want to do is use this SQL in VBA to return a string value but when I try to run the code it errors and highlights this section: ="DistrictSupervisor") and tells me that there has been a compile error Expected: End of Statement.
Any idea why this will run in one situation but not in another?
Any/All help on this is greatly appreciated!
Thanks -Kevin