Using If Function to make visible fields

SpiritedAway

Registered User.
Local time
Yesterday, 21:24
Joined
Sep 17, 2009
Messages
97
Hi - Need some help figuring this out - I'm using Access 2007

I have 3 ticks boxes, "PreApproval", "InterimApproval" & "PostApproval". When I open the form called "ProjectControl" I would like these 3 ticks boxes to be invisibile.

Only when I type in a date in my "ProjectStartDate" field do I only want the "PreApproval" tick box to become visibile - the rest remain hidden.

If I click on the "PreApproval" tick box, I want that to become invisible and "InterimApproval" to be visible.

If I tick "InterimApproval" - that becomes invisible and "PostApproval" becomes visible.

I know it has something to do with the IF Function - but its getting it invisible when I open the form and use a date to make the first one visible that is troubling me.

Any help would be great.

Thanks

SpiritedAway
 
Generally:

Code:
If IsDate(Me.DateField) Then
  Me.OtherField.Visible = True
Else
  Me.OtherField.Visible = False
End If

Depending on the flow you want, you'll need code in each of the control's after update events, plus the current event to handle the changing of records.
 
Thanks Pbaldy for the quick post.

When I open my form how do I make the tickboxes "PreApproval", "InterimApproval", "PostApproval" hidden in the first place.

So that when I use the code you've given me - to make "PreApproval" visible only?

Thanks again for your help.

SpiritedAway
 
You could set their Visible property to No in design view. You'd probably want to handle them all in the current event though. I might even have a function that tested/set all the controls, and call it from each update event plus the current event.
 
I Pbaldy.

If I set the visible property of each tickbox to No - will the VB code still make the tickbox visible - even if after the visible property is set to No?

Thanks

Once Again
 
No, I Pbaldy. :p

Yes, it will.
 

Users who are viewing this thread

Back
Top Bottom