Simple conditions not working

P

Pete Merenda

I have a continuous form of 'Customer' records, each with three controls:
customer name, customer type ID, and segment ID. The ID fields are
multi-value, with column 1 bound in each case. I attached a macro to the 'On
Double Click' action of the 'Customer Name' control to open one of two forms
depending on the value of 'CustomerTypeID'.

Macro conditions are: [CustomerTypeID]=1 OR 2, then open form A. Next
line/condition is [CustomerTypeID]=3, then open form B.

On the 'customers' form, when I double-click 'Customer Name' form A opens
even when [CustomerTypeID]=3.

I have recreated forms and queries, checked the data in tables, and revised
the conditions in a variety of ways but can't seem to figure it out. Is it
possible that the continuous form is the problem...that the macro sees
multiple occurences of [CustomerTypeID]? I'm assuming not.

What am I overlooking...please?
 
P

Pete Merenda

Please disregard. I had two controls with the same name on the same form, one
unbound. Next time I guarantee I'll recognize that problem in less than two
hours...assuming I've eaten and/or slept in the prior 24 hours.
 
S

Steve Schapel

Pete,

Glad you got it sorted. Though I don't think we can take your
explanation literally. It is simply not possible to have two controls
with the same name... Access won't let you.

I would also point out that this Condition will not work:
[CustomerTypeID]=1 OR 2

This will *always* evaluate to True, and will not give the results you
expect.

I think what you mean is:
[CustomerTypeID]=1 OR [CustomerTypeID]=2

Alternatively:
[CustomerTypeID] In(1,2)

--
Steve Schapel, Microsoft Access MVP

Pete said:
Please disregard. I had two controls with the same name on the same form, one
unbound. Next time I guarantee I'll recognize that problem in less than two
hours...assuming I've eaten and/or slept in the prior 24 hours.

Pete Merenda said:
I have a continuous form of 'Customer' records, each with three controls:
customer name, customer type ID, and segment ID. The ID fields are
multi-value, with column 1 bound in each case. I attached a macro to the 'On
Double Click' action of the 'Customer Name' control to open one of two forms
depending on the value of 'CustomerTypeID'.

Macro conditions are: [CustomerTypeID]=1 OR 2, then open form A. Next
line/condition is [CustomerTypeID]=3, then open form B.

On the 'customers' form, when I double-click 'Customer Name' form A opens
even when [CustomerTypeID]=3.

I have recreated forms and queries, checked the data in tables, and revised
the conditions in a variety of ways but can't seem to figure it out. Is it
possible that the continuous form is the problem...that the macro sees
multiple occurences of [CustomerTypeID]? I'm assuming not.

What am I overlooking...please?
 

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

Top