472,145 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,145 software developers and data experts.

Enable/Disable the field in continous form conditionally

Hi all,

I am using the countinous form. I want to Enable/Disable the some
fields for perticular records as per the following condition when
open the form. I have written this code in "On Current Event". I go on
the perticular record its enable/dosable the following field for all
records. I have tried this code in "On Open Even" but there is no
effect.

Please help me to solve this problem.

Private Sub Form_Current()
If (Me.Grade = 9 Or Me.Grade = 10 Or Me.Grade = 11 Or Me.Grade = 12 Or
Me.Grade = 13 _
Or Me.Grade = 14 Or Me.Grade = 15) And Me.TotDay <= 40 Then

Me.ManagerApproval.Enable= False
Me.ManagerConfirmation.Enable= False
Else
Me.ManagerApproval.Enable= True
Me.ManagerConfirmation.Enable= True
End If
End Sub

thanks in advance.
Jun 27 '08 #1
2 4211

"Naushad" <nh*****@kockw.comwrote in message
news:d8**********************************@m3g2000h sc.googlegroups.com...
Hi all,

I am using the countinous form. I want to Enable/Disable the some
fields for perticular records as per the following condition when
open the form. I have written this code in "On Current Event". I go on
the perticular record its enable/dosable the following field for all
records. I have tried this code in "On Open Even" but there is no
effect.

Please help me to solve this problem.

Private Sub Form_Current()
If (Me.Grade = 9 Or Me.Grade = 10 Or Me.Grade = 11 Or Me.Grade = 12 Or
Me.Grade = 13 _
Or Me.Grade = 14 Or Me.Grade = 15) And Me.TotDay <= 40 Then

Me.ManagerApproval.Enable= False
Me.ManagerConfirmation.Enable= False
Else
Me.ManagerApproval.Enable= True
Me.ManagerConfirmation.Enable= True
End If
End Sub

thanks in advance.
I have always used the ! when referencing a control on a form.

Me![Grade]
Me![TotDay]
Me![ManagerApproval].Enable

Jun 27 '08 #2
Naushad wrote:
>I am using the countinous form. I want to Enable/Disable the some
fields for perticular records as per the following condition when
open the form. I have written this code in "On Current Event". I go on
the perticular record its enable/dosable the following field for all
records. I have tried this code in "On Open Even" but there is no
effect.

Please help me to solve this problem.

Private Sub Form_Current()
If (Me.Grade = 9 Or Me.Grade = 10 Or Me.Grade = 11 Or Me.Grade = 12 Or
Me.Grade = 13 _
Or Me.Grade = 14 Or Me.Grade = 15) And Me.TotDay <= 40 Then

Me.ManagerApproval.Enable= False
Me.ManagerConfirmation.Enable= False
Else
Me.ManagerApproval.Enable= True
Me.ManagerConfirmation.Enable= True
End If
End Sub

It might be better to use Conditional Formatting (View menu)
on the controls you want to disable.

Use the Expression Is: option with an expression like:

[Grade] >= 9 And [Grade <= 15] And [TotDay] <= 40

--
Marsh
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by hortoristic | last post: by
reply views Thread by Ian | last post: by
10 posts views Thread by viki1967 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.