Skip Logic

  • Thread starter Thread starter Chuck W
  • Start date Start date
C

Chuck W

Hi,

I am building a table that an input form will feed. I have two Yes/No
questions. One field in my table is called BloodOrderFormUsed and the second
is called BloodOrderFormComplete. I want to create skip logic where the
second field will be grayed out or remain invisible unless the first question
(BloodOrderFormUsed) on a form is answered as Yes. Is there a way to do
this?

Thanks,
 
Chuck

Me!chkBloodOrderFormComplete.Enabled = Me!chkBLoodOrderFormUsed

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
In the form's Current event:

Me.txtBloodOrderFormComplete.Visible = (Me.BloodOrderFormUsed = True)

It should work this way:

Me.txtBloodOrderFormComplete.Visible = Me.BloodOrderFormUsed

In the first case the parentheses may not be necessary, but they make the
logic easier to see. In the second case the default for a Yes/No field is
Yes (or True or 0), so it is not ncessary to write it, although IMO it makes
the code a bit easier to read if the "True" is included.

In either case, the Visible (or Enabled, if you prefer grayed out) property
is Yes/No. Me.BloodOrderFormUsed (or Me.BloodOrderFormUsed = True) both
evaluate to Yes or True, so the statement becomes:

Me.txtBloodOrderFormComplete.Visible = True

You will need the same code in the After Update event of
txtBloodOrderFormUsed (the text box bound to the BloodOrderFormUsed field).

Note that I have used a different name for the text boxes
(txtBloodOrderFormComplete, txtBloodOrderFormUsed) than the field. It is
not always necessary, but it tends to make the code easier to follow, and in
some cases there can be problems if the field and the control have the same
name.
 
Hi,

I am building a table that an input form will feed. I have two Yes/No
questions. One field in my table is called BloodOrderFormUsed and the second
is called BloodOrderFormComplete. I want to create skip logic where the
second field will be grayed out or remain invisible unless the first question
(BloodOrderFormUsed) on a form is answered as Yes. Is there a way to do
this?

Both Jeff and Bruce assume that this is a form in single view, which
may be exactly what you have. However, in continuous view, all the
rows are treated as one, so controlling the visible or enabled
properties won't work as you expect.

If you need similar "skipping" functionality on a continuous form, you
can use the Current and After Update events to control the tab stop
property so that the cursor doesn't land in the field, and you can add
error checking to ensure that a value isn't entered. It's a bit more
complex but it works for data entry scenarios.

Armen Stein
Microsoft Access MVP
www.JStreetTech.com
 
<snicker> What's a continuous form? ...

(thanks Armen, yes, I did assume single view).

Jeff
 
Back
Top