Enter value if certain criterias are met...

P

Peter

I am doing something very wrong…

Form. Fruits. Field. Colours
Subform. Basket

In the subform and in a combox “after update†event I want the following code:

If Me.Type = “Banana†And Form![Fruits].[Colours] = And Not Is “yellow†or
“green†Then
MsgBox. ,….

In other words, Type “Banana†can not be chosen if Colours are other then
green or yellow..

Am I thinking right here….?
 
M

Marshall Barton

Peter said:
I am doing something very wrong…

Form. Fruits. Field. Colours
Subform. Basket

In the subform and in a combox “after update” event I want the following code:

If Me.Type = “Banana” And Form![Fruits].[Colours] = And Not Is “yellow” or
“green” Then
MsgBox. ,….

In other words, Type “Banana” can not be chosen if Colours are other then
green or yellow..


There are a myriad of syntax issues. Try something more
like:

If Me![Type] = “Banana” _
And Forms!Fruits.Colours <> “yellow” _
And Forms!Fruits.Colours <> “green” Then
 
P

Peter

Ok Thanks...were do i put the IsNot

And Forms!Fruits.Colours <> IsNot “yellow†_ ???

Thanks again for your patiance

Marshall Barton said:
Peter said:
I am doing something very wrong…

Form. Fruits. Field. Colours
Subform. Basket

In the subform and in a combox “after update†event I want the following code:

If Me.Type = “Banana†And Form![Fruits].[Colours] = And Not Is “yellow†or
“green†Then
MsgBox. ,….

In other words, Type “Banana†can not be chosen if Colours are other then
green or yellow..


There are a myriad of syntax issues. Try something more
like:

If Me![Type] = “Banana†_
And Forms!Fruits.Colours <> “yellow†_
And Forms!Fruits.Colours <> “green†Then
 
G

Graham Mandeno

Hi Peter

<> means "is not equal to". There is no such operator as IsNot.

--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

Peter said:
Ok Thanks...were do i put the IsNot

And Forms!Fruits.Colours <> IsNot "yellow" _ ???

Thanks again for your patiance

Marshall Barton said:
Peter said:
I am doing something very wrong.

Form. Fruits. Field. Colours
Subform. Basket

In the subform and in a combox "after update" event I want the following
code:

If Me.Type = "Banana" And Form![Fruits].[Colours] = And Not Is "yellow"
or
"green" Then
MsgBox. ,..

In other words, Type "Banana" can not be chosen if Colours are other
then
green or yellow..


There are a myriad of syntax issues. Try something more
like:

If Me![Type] = "Banana" _
And Forms!Fruits.Colours <> "yellow" _
And Forms!Fruits.Colours <> "green" Then
 
P

Peter

Ok, Thanks Graham. I appologize for my ignorance..:)

Graham Mandeno said:
Hi Peter

<> means "is not equal to". There is no such operator as IsNot.

--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

Peter said:
Ok Thanks...were do i put the IsNot

And Forms!Fruits.Colours <> IsNot "yellow" _ ???

Thanks again for your patiance

Marshall Barton said:
Peter wrote:

I am doing something very wrong.

Form. Fruits. Field. Colours
Subform. Basket

In the subform and in a combox "after update" event I want the following
code:

If Me.Type = "Banana" And Form![Fruits].[Colours] = And Not Is "yellow"
or
"green" Then
MsgBox. ,..

In other words, Type "Banana" can not be chosen if Colours are other
then
green or yellow..


There are a myriad of syntax issues. Try something more
like:

If Me![Type] = "Banana" _
And Forms!Fruits.Colours <> "yellow" _
And Forms!Fruits.Colours <> "green" Then


.
 

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