Ben,
I believe the root of the problem is that you are just copying/pasting the code given
to you by Brendan and Bruce, but not making changes to account for *your* actual control names.
This is exactly what you posted in an earlier message:
Begin Quote:This is the code for the 'greyout' of the EmailAddress field on the form:
Private Sub Yesno_email_Click()
Me.EmailAddress_textbox.Enabled = (Not Me.Yesno_email)
End Sub
And this works fine. But this bit dosen't work -
Private Sub Form_Current()
Me!txtEmailAddress.Enabled = Me!chkEmail_YesNo
End SubEnd Quote
Do you see the difference in CONTROL names?
In one spot you have EmailAddress_textbox and the other txtEmailAddress.
For the check box you have Yesno_email in one spot and chkEmail_YesNo in the other.
Access is totally confused right now!
Brendan then provided this bit of code:
Begin Quote
rivate Sub Form_Current()
Me!chkEmail_YesNo.SetFocus
Me!txtEmailAddress.Enabled = (Me!chkEmail_YesNo)
End SubEnd Quote
You then said:
Run-time error '2465':
MS Access can't find the field 'chkYesno_email' referred to in your expression.
Do you see the issue?
If you just copied the code, but did not adjust it for your actual control names,
then Access naturally cannot find the control you are referring to.
Step back a minute and take a hard look at the code and make adjustments
for the control names you actually have.
So ***IF*** your two controls are named:
EmailAddress_textbox
Yesno_email
then Brendan's code should look like this in the Current event of the form:
Private Sub Form_Current()
Me!Yesno_email.SetFocus
Me!EmailAddress_textbox.Enabled = (Me!Yesno_email)
End Sub
BUT, double check the control names first!
If you are still having problems, please post back with the
actual control names on the form.
BTW, for future reference, it is usually good practice to avoid having spaces in control names