Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF Statement 1

Status
Not open for further replies.

techkenny1

Technical User
Jan 23, 2009
182
AU
Hi
I require some help in formulating an IF statment.
On a form that details clients data I have a check box which if it is a company would = true and if private would = false.

What I need is that when you come to a private record some of the data fields afre made invisible.
I tried this to see if it would work..

Private Sub PrCo_AfterUpdate()
If PrCo = true then
Fieldname.visible = false

Else

Fieldname.visible = true

End if

End Sub

But it does not work..

What error have I made please


kp
 
Your first error is in not telling us your results. "it does not work" doesn't tell us much.

I would put "company" in the tag property of all the controls that would display for Company but not for private. Then use a small procedure that loops through all the controls on the form looking for those with company in the tag property. If found, set the control's visible property to Me.PrCo.

You would need to call the small procedure from the On Current event of the form and the After Update event of PrCo.

Duane
Hook'D on Access
MS Access MVP
 
Hi all,
Many thanks for your replies.
I put the code to the on current event, it works great.

many thanks for the help
kp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top