Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Re: Server filter


Message #1 by "Mavin Specimen" <mspecimen@h...> on Wed, 17 Oct 2001 21:37:54
I am converting an Access mdb(which I din't create) into an Access Project. A form uses an SQL statement
as the recordsource. When I try to open the form, I get the error message:" Invalid sql statement.Check the server filter on the
forms recordsource". Here is the sql statement. What does this error message mean?



SELECT     [tbl_Fiscal Figures].EngRecordID, [tbl_Fiscal Figures].Fiscal, [tbl_Fiscal Figures].[Fiscal Comment]

FROM         [tbl_Fiscal Figures]

WHERE     ((([tbl_Fiscal Figures].EngRecordID) = nz([Forms] ! [frm_Project Status] ! [sub_FinancialInfo].[Form] ! [EngRecordID]))
AND (([tbl_Fiscal Figures].Fiscal) 

                      = nz([Forms] ! [frm_Project Status] ! [sub_FinancialInfo].[Form] ! [Fiscal])));n.com</a><br></html>
Message #2 by Brian Skelton <brian.skelton@b...> on Wed, 17 Oct 2001 23:49:52 +0100
Mavin



I can see a couple of possibilities:



1) the nz function may be causing the error. I think Access converts the 

SQL statement to a SQL Server View when you attempt to open the form. 

So, you cannot use Access functions as part of the SQL statement.



2) Check the Server Filter property of the the form (down near the 

bottom of the properties sheet). This might contain the invalid SQL 

statement.



-BDS



Message #3 by "Pardee, Roy E" <roy.e.pardee@l...> on Thu, 18 Oct 2001 07:41:42 -0700
I think the problem is that the control references in your WHERE statement

mean nothing to the server--it doesn't know from forms.  I think you'll have

to build up an SQL string containing the literal values that those controls

hold and pass that string to the server instead.  Of course you'll also have

to include code to change the SQL when the values of those controls

change...  (Maybe a stored proc would be better?).



Also, Brian is right--SQL server doesn't have an Nz() function--have a look

at SQL Server's IsNull() function as a substitute.



Cheers,



-Roy



Roy Pardee

Programmer/Analyst

SWFPAC Lockheed Martin IT

(xxx) xxx-xxxx




  Return to Index