Re: Prevent data entry if another field contains data

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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



.



Relevant Pages

  • Re: Prevent data entry if another field contains data
    ... My one line of code accomplishes the exact same thing as your 5 lines of ... Your second set of code does raise a good point though. ... mistake was made, for instance) having that data deleted. ...
    (microsoft.public.access.formscoding)
  • Re: wanted creature from the black lagoon translite
    ... unintentional, but it was *my* mistake, and I owned up to it. ... Yet, this pest-like idiot *continued* to exhibit the same, exact ... If that means that I've "run him off from the newsgroup," as you pretty ... *any* of them, besides you, defending this guy? ...
    (rec.games.pinball)
  • Re: .999... ?= 1
    ... in IR or Q any exact number is a fictitious one in so far it just ... the resolution the lesser the chance of relevance to a particuzlar ... Even if my command of English is shaky in general and not British at ... Continental style. ...
    (sci.math)
  • Re: make installkernel fails instantly w/ signal 11
    ... On 6/11/05, Keyser wrote: ... >> Vladimir Dvorak ... > Just tried it, exact same error. ... Any chance your processor or other pieces of the machine are ...
    (freebsd-questions)
  • Re: A diagonal line prints across part of my Publication
    ... Any chance you'd send me the file and let me see if I can figure out why? ... I'm a hands-on kind of woman. ... Send it to jl dot paules at gmail dot com. ... > happens in the exact same place. ...
    (microsoft.public.publisher)