Select to view content in your preferred language

SQL syntax in query filter interface

779
5
04-25-2010 03:03 AM
RadekHýbner
New Contributor
Hi
I am writing some tool in ArcGIS desktop 9.3 in VBA and I need to extract data in table by query filter interface.
I have data in personal db and
pQf.WhereClause = "TextString <> Null"
is OK. But when I have data in File db theres a problem. I know that there is syntax a little different... but I can not find correct version.
Thanks.
0 Kudos
5 Replies
StefanOffermann
Occasional Contributor II
For File Geodatabase, you have to enquote field names with double quotes:

"Field" = 'Value'

see: http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=SQL_reference

regards, Stefan
0 Kudos
RadekHýbner
New Contributor
thanks for reply.
but I tried this before and it writes me that it is not correct...
0 Kudos
StefanOffermann
Occasional Contributor II
Then you have an error in your code. The double quotes are the right way. I don't know the exact way in VBA to escape the double quotes, in C# I would write:

pQf.WhereClause = "\"FieldName\" <> Null" 


You should check how to use
<>

and
Null

in VBA.
0 Kudos
JohnHauck
Occasional Contributor II
You can use the following for either File or Personal geodatabase:

pQF.WhereClause = "YourFieldName IS NOT NULL"
0 Kudos
RadekHýbner
New Contributor
correct is
pQF.WhereClause = "YourFieldName IS NOT NULL"
thanks
0 Kudos