Problem with after update code in field that disables another field

  • Thread starter Thread starter SamJ
  • Start date Start date
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
 
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."
 
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.
 
Back
Top