Problem with after update code in field that disables another field

S

SamJ

Hi

I want to be able to disable the Non Member field in a record when
something is entered in the Member field. Unfortunately, the code I am
usng below disables the Non Member field in *all* records, and the
database has to be closed and reopened to get round this before data
entry can continue.

I'd be grateful if someone could show me the correction, Thanks.


Private Sub Member_AfterUpdate()

If Not IsNull([Member]) Then
Me![Non Members].Enabled = False
Else
Me![Non Members].Enabled = True
End If
End Sub
 
A

Al Campagna

Sam,
You need to put that same code in on the OnCurrent event of the form.
When you programatically disable a field during a form "session" it will
disable that field on all records.
Using your code in the OnCurrent event of the form, allows you to examine
the Member value of that record, and Enable/Disable accordingly.

--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
S

SamJ

Sam,
You need to put that same code in on the OnCurrent event of the form.
When you programatically disable a field during a form "session" it will
disable that field on all records.
Using your code in the OnCurrent event of the form, allows you to examine
the Member value of that record, and Enable/Disable accordingly.

Ok, thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top