> i have a combo box field called type of employed whereby the user can
> select either
[quoted text clipped - 20 lines]
>
> Thanks
This should work for the IIf() expression:
=IIf([Type of employment]
In ("Company", "Self employed (External)"),
"Not Applicable","Please Press Browse Course")
I had to break it onto multiple lines for the newsreader, but it would
really be one line.
But you should be aware that binding your text box to an expression like
this will make it uneditable. Was it your intention that the user
should enter something in this text box if [Type of employment] is "LSBU
employed (Internal)", and that otherwise the text box should be
disabled? If so, you shouldn't bind the text box to an expression. You
might use code in the form's Current event and in the AfterUpdate event
of [Type of employment] to set the text box's Enabled property.
Something like:
'----- start of example code -----
Private Sub EnableDisableCourseCodes()
Me!CourseCodes.Enabled = _
(Me![Type of employment] = "LSBU employed (Internal)")
End Sub
Private Sub Form_Current()
EnableDisableCourseCodes
End Sub
Private Sub Type_of_employment_AfterUpdate()
EnableDisableCourseCodes
End Sub
'----- end of example code -----
I don't know if that's exactly what you're after or not, but it rather
sounded like you want something like that.

Signature
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
Connie - 05 Apr 2005 04:19 GMT
I added this to the forms current event and i got an error message saying
"compile error: sub or function not defined?"
Private Sub Form_Current()
EnableDisable [Course Code]()
Form_Sw![Course Code].Enabled = _
(Form_Sw![Type of employment] = "LSBU employed (Internal)")
EnableDisable [Course Code]
End Sub
> > i have a combo box field called type of employed whereby the user can
> > select either
[quoted text clipped - 62 lines]
> I don't know if that's exactly what you're after or not, but it rather
> sounded like you want something like that.
Dirk Goldgar - 05 Apr 2005 04:42 GMT
> I added this to the forms current event and i got an error message
> saying "compile error: sub or function not defined?"
[quoted text clipped - 6 lines]
> EnableDisable [Course Code]
> End Sub
That's not a whole lot like what I posted. I guess that "Course Code"
is the name of the text box to be enabled or disabled. Is that correct?
Also, I'm assuming that this code is all running in the code module of
the form that has the controls [Type of employment] and [Course Code].
If that's true, try this:
'----- start of revised code -----
Private Sub EnableDisableCourseCodes()
Me![Course Code].Enabled = _
(Me![Type of employment] = "LSBU employed (Internal)")
End Sub
Private Sub Form_Current()
EnableDisableCourseCodes
End Sub
Private Sub Type_of_employment_AfterUpdate()
EnableDisableCourseCodes
End Sub
'----- end of example code -----
Please note that there are three Subs there. It looks like you pasted
my original code all into the shell of the Form_Current Sub, which was
not the right way to do it. If you have no other code in the form's
module besides the code you tried to insert from my example, remove all
of that and paste this into the module's Declarations section, a line or
two below the "Option Compare Database" and "Option Explicit" lines.
(You may not have an "Option Explicit" line, depending on how you have
your VB options set).

Signature
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)