> Dennis.
>
[quoted text clipped - 5 lines]
>> that it cannot find field A in my expression. i think i write it
>> incorrectly. can u help?
Dennis,
I had assumed you were running the macro from an event on a form. If
so, by putting the Condition like I suggested before...
[field A]=1
... will refer to the value of field A in the current record in the form.
You can't refer to the value of the field in a table in the way you
have. It is incorrect syntax, and anyway, Access would need to know
which record in the table you are talking about before it could be
evaluated - if you see what I mean. You could use a Domain Aggregate
Function, such as DLookup() or DMax(), in the macro Condition, to refer
to the value of field A in a particular record in the table. So, sorry,
I still have question for you... Where are you calling the macro? And
how do you know which record in the table to see the field A value?

Signature
Steve Schapel, Microsoft Access MVP
> Steve,
>
> i am sorry that i didn't make it very clear. field A is the field name a
> field in a table and its table name is tbl01. i need the macro to run macro
> 1 if field A in table tbl01=1 and run macro2 if field A in table tbl01=2.
> thx again.
Dennis Cheung - 29 Dec 2005 08:23 GMT
Steve,
Both Macro1 and Macro2 are openquery event. In table1, there is only one
record in it. I thought Access would know which record match the criteria.
But your question made me understand i was wrong. since there could be more
than one record in table1. I may try to use the Dlookup(), but i'd never
used this function before. would you let me know more details?
Dennis
> Dennis,
>
[quoted text clipped - 18 lines]
>> macro 1 if field A in table tbl01=1 and run macro2 if field A in table
>> tbl01=2. thx again.
Steve Schapel - 29 Dec 2005 17:51 GMT
Dennis,
When I asked about 'event', I meant when is the macro run, for example
Click event of a command button. OpenQuery does not mean the event,
this is the Action in the macro.
Try the macro condition like this...
DLookup("[Field A]","tbl01")=2

Signature
Steve Schapel, Microsoft Access MVP
> Steve,
>
[quoted text clipped - 3 lines]
> than one record in table1. I may try to use the Dlookup(), but i'd never
> used this function before. would you let me know more details?
Dennis Cheung - 30 Dec 2005 03:02 GMT
Steve,
The event is a click event of a command button. And The Dlookup works fine.
It does what i need. Thanks for your support.
Dennis Cheung
> Dennis,
>
[quoted text clipped - 14 lines]
>> than one record in table1. I may try to use the Dlookup(), but i'd never
>> used this function before. would you let me know more details?