Re: Prevent data entry if another field contains data
- From: "Dale Fye" <dale.fye@xxxxxxxxxx>
- Date: Fri, 30 Nov 2007 18:01:57 -0500
Linq,
My one line of code accomplishes the exact same thing as your 5 lines of
code. The expression to the right of the equal sign will return either True
or False, either locking or unlocking txt_FieldB.
Your second set of code does raise a good point though.
Dale
"Linq Adams via AccessMonster.com" <u28780@uwe> wrote in message
news:7bfdb39991b80@xxxxxx
The code needs, I think, to be
If LEN(Me.txt_FieldA & "") > 0 Then
Me.txt_FieldB.Locked = True
Else
Me.txt_FieldB.Locked = False
End If
Otherwise, if you move from a record where txt_FieldA has data, to a
record
where txt_FieldA doesn't have data, txt_FieldB will still be locked!
Also, this allows for the possibility of txt_FieldA having data, then (if
a
mistake was made, for instance) having that data deleted.
On the chance that your user has already entered data in txt_FieldB before
going to txt_FieldA (users do illogical things!) you might want to include
a
line, in the AfterUpdate event, to take out anything already in
txt_FieldB:
If LEN(Me.txt_FieldA & "") > 0 Then
Me.txt_FieldB = ""
Me.txt_FieldB.Locked = True
Else
Me.txt_FieldB.Locked = False
End If
--
There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000/2003
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200711/1
.
- Follow-Ups:
- Re: Prevent data entry if another field contains data
- From: A_Classic_Man
- Re: Prevent data entry if another field contains data
- Prev by Date: Re: Auto-populate fields
- Next by Date: Re: Auto-populate fields
- Previous by thread: Re: Auto-populate fields
- Next by thread: Re: Prevent data entry if another field contains data
- Index(es):
Relevant Pages
|