Tick box dilema

G

Guest

I have created a form with various fields, two of those fields are:
A tick box (A) and
A field that appears if the tick box is checked (B).

Im having trouble with this as I have managed to get field (B) to appear if
field (A) is checked but when I close and reopen the form, field (B) is
hidden even if field (A) is checked.

What im looking for is a form so that when field (A) is checked, field (B)
will be visible and vice versa. HELP!
 
G

Guest

I assume you have put code in the After Update event of the check box to make
field B visible or invisible ?
If I have assumed correctly, then you need to put the same code in the On
Current event of the form.
This event triggers when the form is opened and when you change records.
 
G

Guest

I have put this code in both fields

[Attach/View Document].Visible = [Soft Copy]
(Field B) (Field A)

But still upon entering the form (field B) is not visible even when (field
A) is checked.

:-(
 
G

Guest

What do you mean 'in both fields' ?
You only need to put it in the 'After Update' Event of Field A, no coding
required for field B
But, it also needs to go into the 'On Current' event of the FORM
 
G

Guest

With your properties window open, use the drop down box at the top of this
properties window and select form. The On Current is an event for the form
and not for a control on the form.
You can also get to the form properties by double clicking the black square
in the top left corner of your forms design window.
 
R

Rich Wills via AccessMonster.com

You basically need a few bit's of code...

1.

Form OnCurrent

if me.FIELDA like "*" then
me.CHECKA = -1
me.FIELDB.visible = true
else
end if

if me.FIELDB like "*" then
me.CHECKB = -1
me.FIELDB.visible = true
else
me.CHECKB = 0
me.FIELDB.visible = false
end if

end sub

2.

FIELDA_AFTERUPDATE

If me.FIELDA Like "*" then
me.FIELDB.visible = true
me.CHECKB = -1
else
if me.FIELDB like "*" then
me.CHECKB = -1
me.FIELDB.visible = true
else
me.CHECKB = 0
me.FIELDB.visible = false
end if
end if

End sub

'I think this is all you need let me know if I'm on your lines!!

Hope it helps

Rich
 
R

Rich Wills via AccessMonster.com

Right-click on the gray-area at the bottom of the details of the form this
will give you the properties of the FORM it is located in the events tab of
this.

Rich
 
G

Guest

Cheers found it, but still not working

[Attach/View Document].Visible = Not SoftCopy
(Field B) (Field A)

is this the correct code to use to enable me to do what i want?

If not could you suggest an alternative.
 
G

Guest

I've just created a test table and test form using your field names as well.
I have put your code in the after update event of the check box and the on
current event of the form. I opened the form and moved between records and
the field appeared and disappeared as I would expect. I tick and untick the
check box and the field appears and disappears. I don't know why it is not
working on yours.
 

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