Tick Box to show/hide another label

G

Guest

I have set up a form so when the user ticks the box it shows another field.
The field that is hidden I have made invisible so when the form is opened it
is invisible and when the button is ticked it appears, great. The problem is
that when I go onto the next record the hidden field is visible even without
the button being ticked and if i reopen the form even buttons that are ticked
does not display the field that should be visible?

I have used this code:

If [Soft Copy] = True Then
[Attach/View Document].Visible = True
[Attach/View Document].Visible = True
Else
[Attach/View Document].Visible = False
[Attach/View Document].Visible = False
End If

*Soft Copy = Tick Box
*Attach/View Document = Hidden label

I need help to enable the field to be hidden when opening the form and
inserting a new record and if the tick box is ticked for that field to stay
visible.

Hope this makes sense.
 
D

Danny J. Lesandrini

If I'm understanding you correctly, you need to put your code in the
OnCurrent event. That way, when a new record is displayed, the
value of the check box is applied.
 
T

Thomas Winkler

Hi,
If [Soft Copy] = True Then
[Attach/View Document].Visible = True
[Attach/View Document].Visible = True
Else
[Attach/View Document].Visible = False
[Attach/View Document].Visible = False
End If

Or shorter:

[Attach/View Document].Visible = [Soft Copy]

or

[Attach/View Document].Visible = Not [Soft Copy]

Thomas
 
G

Guest

Sorry if im being stupid but i cant seem to find where the OnCurrent event is?

Danny J. Lesandrini said:
If I'm understanding you correctly, you need to put your code in the
OnCurrent event. That way, when a new record is displayed, the
value of the check box is applied.

--

Danny J. Lesandrini
(e-mail address removed)
http://amazecreations.com/datafast/



Scottyboy said:
I have set up a form so when the user ticks the box it shows another field.
The field that is hidden I have made invisible so when the form is opened it
is invisible and when the button is ticked it appears, great. The problem is
that when I go onto the next record the hidden field is visible even without
the button being ticked and if i reopen the form even buttons that are ticked
does not display the field that should be visible?

I have used this code:

If [Soft Copy] = True Then
[Attach/View Document].Visible = True
[Attach/View Document].Visible = True
Else
[Attach/View Document].Visible = False
[Attach/View Document].Visible = False
End If

*Soft Copy = Tick Box
*Attach/View Document = Hidden label

I need help to enable the field to be hidden when opening the form and
inserting a new record and if the tick box is ticked for that field to stay
visible.

Hope this makes sense.
 
T

Thomas Winkler

Hi,
Sorry if im being stupid but i cant seem to find where the OnCurrent event
is?

This is an event on your Form. Open it in Design View and move to the tab
'Events'. There you find your OnCurrent-Event.

Thomas
 
G

Guest

Hi again

It still appaers to have the same problems. When i open the record any boxes
that are ticked the label is not showed and if i add a new record and tick
the box the next record that i add still has the hidden label visible, even
without the box being ticked. im confused
 
T

Thomas Winkler

Hi,
It still appaers to have the same problems. When i open the record any boxes
that are ticked the label is not showed and if i add a new record and tick
the box the next record that i add still has the hidden label visible, even
without the box being ticked. im confused

Sorry, but of course you have to care about what should happen if the user
checks/unchecks the box.
Therefore the AfterUpdate-Event of the checkbox is responsible. There you
have to place the same code as in OnCurrent...

Private Sub SoftCopy_AfterUpdate()

[Attach/View Document].Visible = SoftCopy

or

[Attach/View Document].Visible = Not SoftCopy
End Sub
 
G

Guest

I have done everything suggested but still when i first open the form all
records with the tick box 'ticked' still do not display the contents and when
i add a new record and tick the box the record after that automatically
display the hidden field. Why is this not working :-(
 

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