Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2012

    Unhappy Unanswered: Help with disabling fields temporarily

    Hi. I have a field named "Storage Name" in a form called BM_Maps.

    I have set this up so that once this field is populated it can't be changed. So when it is NULL the user can add a new entry, but cannot edit existing entries.

    Once data is entered, on exit a new subform opens as a dialog box called SaveMapNamePrompt, with a Save and Undo button. The Save simply closes the form and leaves the field populated as is. The Undo button closes the form and replaces what the user added with NULL so the user can retype a correct storage name.

    The problem is, if the user types a new storage name, if they hit tab or enter, or click on screen it activates another field, so when they hit Undo in the SaveMapNamePrompt dialog box, the field that was being added is no longer the focus and the new entry isn't replaced with NULL and the user can't fix their mistake.

    How can I disable other fields so that the focus remains in the new storage name field when the user hits Undo.

    The NULL has worked before on occasions, but generally other fields are accidently clicked on or the user clicks Tab which activates the next field, leaving the new storage name populated incorrectly.

    Any help appreciated.


  2. #2
    Join Date
    Sep 2006
    Surrey, UK
    Provided Answers: 2
    Difficult to say without seeing your code, but I would suggest explicitly naming the fields to be set to Null rather than relying on the active field.
    10% of magic is knowing something that no-one else does. The rest is misdirection.

  3. #3
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    there's separate issues

    to lock once a value has been set then you need to place some code which enables or disables the control

    pre previous data thats easy. in the forms 'on current event' place some code such as

    if isnull(mycolumname) or length(mycolumnname)=0 then
    mcontrolname.enabled = true
    mcontrolname.enabled = false

    the trickier thing is how do you handle the situation where someone has put data into the control and may want to edit it or revisit the control.

    you could put the above code into a subroutine and call it fromt he on current evetn AND whereever else it was felt appropriate

    you need to decide should the control become locked
    probably best to set it in the after update event.

    bear in mind however that although you can lock the control in the form you cannot stop someone updating the value int he actual table if they have any nous about them. securing MS Access applications talking to JET is very very tricky if actually possible at all
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Feb 2012
    Quote Originally Posted by joshuag View Post
    Once data is entered, on exit a new subform opens as a dialog box called SaveMapNamePrompt
    Just curious: why a special dialog rather than a Yes/No msgbox?

  5. #5
    Join Date
    Mar 2012
    Thanks for the replies. I will look into this tomorrow. I'll also look at this Yes/No box. Still learning the ropes.


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts