If statement to change check box value

G

Guest

I would like to create an If statement to change the value of a checkbox from
no to yes if the text in another field of the record meets my criteria. In
other words, if the text in the field "Employee" says "yes", then I want the
checkbox in the field "Exempt" to be checked. If the "Employee" field is
blank, I want the checkbox to be blank.

This is an easy formula in an Excel table (=IF (CELL1="yes",yes, no), but
I'm new to Access and not sure what code I should use or where I should put
it within my table. Any help?
 
G

Guest

Use a macro with a condition and action Set Value. You will need to
determine when/what would trigger the macro.
 
G

Guest

Sorry, I am a "new user" and this is a little over my head. I haven't even
touched macros yet, so far I've just been working with tables, queries and
forms. I will need more guidance on macros if I am to do this...

Is there not just a simple way to enter a formula in the table or query like
one would do in Excel?

Thanks very much for your response!!!
 
G

Guest

Thought it might help to show what I have done to this point...

In the Criteria row of the check box field, I entered:
IIf([EMPLOYEE]<>"yes",No,Yes)

I was trying to follow the same syntax as an Excel formula, which clearly
isn't the solution. When I save and run the query, it eliminates all records
that have "yes" in the EMPLOYEE field.
 
G

Guest

You can use either code or a macro. But first as I said you will need to
determine when/what would trigger the macro or code.

Another solution is to run an update query. Again you will need to
determine when/what would trigger the query. Create a SELECT query with the
field to be updated and the field that is the decision is made on. Add the
criteria to that field. Run the query just for a check to see if the correct
records are being pulled. Then change the query to an update query by
opening the query in design view. Move your cursor over the icons on the
tool bar - look for the one that looks like a datasheet and an arrow head
pointing down. The text tip will say Query Type. Click the arrow head and
select Update Query. Enter the new information in the query grid. Run.
 

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