CONDITIONS IN MACRO

G

Guest

I'm using Access 2002. I am trying to create a macros that looks at adata
field and sets a value depending on the results. The field is [CLASS] which
is how it's named on the table. But, when I type [CLASS]="X" in the Condition
column of the Macro, Access changes it to [Class]="X" and the macro fails to
operate properly. It seems the lower case is causing no match to be found.
Any ideas if the case is the issue and if so, how do I get Access to keep it
all upper case ? Or...any other thoughts ?
 
B

Bob Quintal

I'm using Access 2002. I am trying to create a macros that looks
at adata field and sets a value depending on the results. The
field is [CLASS] which is how it's named on the table. But, when I
type [CLASS]="X" in the Condition column of the Macro, Access
changes it to [Class]="X" and the macro fails to operate properly.
It seems the lower case is causing no match to be found. Any ideas
if the case is the issue and if so, how do I get Access to keep it
all upper case ? Or...any other thoughts ?

No, it's the fact that Class is a reserved word in MS-Access and by
design reserved words take precedence over field names. You can
rename the field, or disambiguate the name by specifying the
table/queryname: [MyTable]![Clas] = "X"

My fifteen years of working with Access say "rename the field."
 
G

Guest

Bob,

Thanks. I did a lot of trouble shooting and I think the issue is more that
I'm using a "wildcard" (asterisk) in the Condition statement. Please see
another posting I just sent out. I wonder if I should have replied to my
initial posting instead of creating a new one. As it turns out using "Class"
works if I don't use the wildcard. The problem seems to be with the wildcard
use.

Bob Quintal said:
I'm using Access 2002. I am trying to create a macros that looks
at adata field and sets a value depending on the results. The
field is [CLASS] which is how it's named on the table. But, when I
type [CLASS]="X" in the Condition column of the Macro, Access
changes it to [Class]="X" and the macro fails to operate properly.
It seems the lower case is causing no match to be found. Any ideas
if the case is the issue and if so, how do I get Access to keep it
all upper case ? Or...any other thoughts ?

No, it's the fact that Class is a reserved word in MS-Access and by
design reserved words take precedence over field names. You can
rename the field, or disambiguate the name by specifying the
table/queryname: [MyTable]![Clas] = "X"

My fifteen years of working with Access say "rename the field."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top