Charlotte Foust
cfoust at infostatsystems.com
Mon Sep 13 10:58:17 CDT 2004
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