Ticking a tick box based on the contents of another field.

R

Richard Horne

Hi guys,

Simple query really.

I have a Yes/No tick box called Item_Complete which I want to be ticked when
another field called Quantity Remaining is 0. Am I correct in that the code
should be

IIf([Quantity Remaining]="0",0,-1)

Now, which event do I attach this code to for the Yes/No box?
 
D

Douglas J. Steele

Are you updating Quantity Remaining on your form, or are you simply using
the value that's in the recordset that's bound to your form?

If the latter, the easiest approach would be to add that computed field to
the query on which the form is based. If the former, you'll also need to put
logic in the AfterUpdate event of the Quantity Remaining field.
 
R

Richard Horne

My Quantity remaining field is simply Quantity - Quantity Delivered.

I'm pretty sure that the code I posted isn't too far off the answer but I'm
just not having any luck getting it to work.

Douglas J. Steele said:
Are you updating Quantity Remaining on your form, or are you simply using
the value that's in the recordset that's bound to your form?

If the latter, the easiest approach would be to add that computed field to
the query on which the form is based. If the former, you'll also need to put
logic in the AfterUpdate event of the Quantity Remaining field.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Richard Horne said:
Hi guys,

Simple query really.

I have a Yes/No tick box called Item_Complete which I want to be ticked when
another field called Quantity Remaining is 0. Am I correct in that the code
should be

IIf([Quantity Remaining]="0",0,-1)

Now, which event do I attach this code to for the Yes/No box?
 
R

Richard Horne

My Quantity remaining field is simply Quantity - Quantity Delivered.

I'm pretty sure that the code I posted isn't too far off the answer but I'm
just not having any luck getting it to work.

Douglas J. Steele said:
Are you updating Quantity Remaining on your form, or are you simply using
the value that's in the recordset that's bound to your form?

If the latter, the easiest approach would be to add that computed field to
the query on which the form is based. If the former, you'll also need to put
logic in the AfterUpdate event of the Quantity Remaining field.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Richard Horne said:
Hi guys,

Simple query really.

I have a Yes/No tick box called Item_Complete which I want to be ticked when
another field called Quantity Remaining is 0. Am I correct in that the code
should be

IIf([Quantity Remaining]="0",0,-1)

Now, which event do I attach this code to for the Yes/No box?
 
B

Bruce

How about if you remove the quotes from the 0? You are looking for a
calculated value of 0, not a literal character. I would think the code would
be the After Update event of Quantity Delivered. I am assuming here that
Quantity Remaining is a calculated value that is not stored.

Richard Horne said:
My Quantity remaining field is simply Quantity - Quantity Delivered.

I'm pretty sure that the code I posted isn't too far off the answer but I'm
just not having any luck getting it to work.

Douglas J. Steele said:
Are you updating Quantity Remaining on your form, or are you simply using
the value that's in the recordset that's bound to your form?

If the latter, the easiest approach would be to add that computed field to
the query on which the form is based. If the former, you'll also need to put
logic in the AfterUpdate event of the Quantity Remaining field.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Richard Horne said:
Hi guys,

Simple query really.

I have a Yes/No tick box called Item_Complete which I want to be ticked when
another field called Quantity Remaining is 0. Am I correct in that the code
should be

IIf([Quantity Remaining]="0",0,-1)

Now, which event do I attach this code to for the Yes/No box?
 

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