[AccessD] Section is a Reserved Word? How to refer to a FieldofThat Name

Nicholson, Karen cyx5 at cdc.gov
Mon Sep 13 13:08:10 CDT 2004


I have spent the last 1.5 years doing nothin' but SQL.  Now I have a new
job and I am taking about ten or eleven bad bad Access 2002 FE's with
SQL 2000 BE's and converting a million macros to code, fixing the flat
as a board data structure, etc.  I guess I have forgotten some things
about Access during my time away from it.  I am getting back on board
and having some fun.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte
Foust
Sent: Monday, September 13, 2004 11:58 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] Section is a Reserved Word? How to refer to a
FieldofThat Name


Forms have a section property, so you are probably colliding with that
when you try to set a value, especially with the syntax shown in your
example.  You're referring to the controls as members of an unspecified
collection rather than using the bang (!) to specify the controls.  If
you do that with Section, the jet engine is going to assume you're
trying to set a section property and object to the fact that you haven't
specified WHICH section (i.e., the missing argument).

Access 2000 and up really don't appreciate a field called Section.  We
had to change fields with that name in all our apps when we migrated.
The only way to get around the problem that I know of in code is to use
something like [Forms]![MyForm]![Section] for the form, and
rst.Fields("Section") for a recordset.  You should talk to your DBA
about changing that field name before it gives you more headaches.

Charlotte Foust


-----Original Message-----
From: Nicholson, Karen [mailto:cyx5 at cdc.gov] 
Sent: Friday, September 10, 2004 12:19 PM
To: accessd at databaseadvisors.com
Subject: [AccessD] Section is a Reserved Word? How to refer to a Field
ofThat Name


This code works and compiles just fine:

        If ([Forms]![frmASRSSectInit].[RequestType] <> "site audit" _
        And [Forms]![frmASRSSectInit].[Status] = "Open" _
        And [Forms]![frmASRSSectInit].[ysnCBRNTest] = 0 _
        And Not IsNull([Forms]![frmASRSSectInit].[ASSectCompletedDate]))
_
        And IsNull([Forms]![frmASRSSectInit].[CBRN_FinalTestReport]) _
        Then
        [Forms]![frmASRSSectInit].[ysnCBRNTest] = -1
        End If

However, there is a numeric field in my table and on my form named:
Section.  It must be a reserved word, because when I change the code to
specify that the section should equal 2, I get a compile error, argument
not optional.  Yikes!  A Friday headache is upon me.  What ever can I do
to get around this?  I can't change the field name as it is an SQL
backend and the damn would break.

        If ([Forms]![frmASRSSectInit].[RequestType] <> "site audit" _
        And [Forms]![frmASRSSectInit].[Status] = "Open" _
        And [Forms]![frmASRSSectInit].[ysnCBRNTest] = 0 _
        And [Forms]![frmASRSSectInit].[Section] = 1 _
        And Not IsNull([Forms]![frmASRSSectInit].[ASSectCompletedDate]))
_
        And IsNull([Forms]![frmASRSSectInit].[CBRN_FinalTestReport]) _
        Then
        [Forms]![frmASRSSectInit].[ysnCBRNTest] = -1
        End If

Karen Nicholson
National Laboratory
Xerox Global Services


-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list