JMB said:
I removed all references to all events from the subform - saved it and the
subform still creates a new record when pressing the Page Down Key, so I
am
assuming it is not the code.
That would make sense, but I'm still not convinced.
There are several fields that are coded On Enter - On Exit - On Got Focus
and On Lost Focus Events. What I am trying to accomplish (and it does
work!!!) is to Lock the field when a value of "Approved" is selected and
to
stay Unlocked when other values are selected or if the field is Null.
Here's
the code I am using on each one of the above mentioned events and this is
working correctly.
Private Sub cmb_CurrentROMStage_Enter()
If ([cmb_CurrentROMStage]) = "Approved" Then
Me![cmb_CurrentROMStage].Locked = True
End If
If ([cmb_CurrentROMStage]) = Null Then
Me![cmb_CurrentROMStage].Locked = False
End If
If ([cmb_CurrentROMStage]) = "Estimating" Then
Me![cmb_CurrentROMStage].Locked = False
End If
If ([cmb_CurrentROMStage]) = "Completed" Then
Me![cmb_CurrentROMStage].Locked = False
End If
If ([cmb_CurrentROMStage]) = "N/A" Then
Me![cmb_CurrentROMStage].Locked = False
End If
End Sub
=====
Is there a way that I could code the On Key Down event to NOT create a new
record? Would I have to do the coding on each field or could it just be
done
at the form level? What would the code be?
The code above would *not* dirty the record, since it doesn't change the
value of any control, only the Locked property. The Enter event may not be
the right event for what you're doing, and this particular test:
If ([cmb_CurrentROMStage]) = Null Then
.... will never evaluate to True -- use "If IsNull(cmb_CurrentROMStage) Then"
instead -- but let's try to figure out what's causing the record-creation
before revising that.
Would you mind copy/pasting the whole, complete module code from the
subform? Maybe I can see something from that.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)