MS Access - Make double click mandatory to enter data into field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • David Wright
    New Member
    • Jan 2009
    • 11

    MS Access - Make double click mandatory to enter data into field

    Hello All

    I am using Microsoft Access 2003. I have an input form (Single Form) into which the clerk records appliance details. Some appliance details will never change, for instance the 'Make and Model'. Some details will need to be updated later on, for instance the location of the appliance. When updates are required, the user opens the update form (Single Form). The user is able to cycle through all records of appliances using this form. Fields which never need to be updated are presented to the data entry clerk but have been locked to prevent accidental changes. I have set the TAB STOP property on the unlocked, updatable fields to NO. This is my first attempt at preventing accidental changes. I would like to make DOUBLE CLICK a prerequisite before ‘data entry’ or ‘change’ can take place within the updatable fields. Would someone please help me out with an example of the code I need to use to achieve this. I expect it will be something to do with the double click event of the field property?

    Thank you in anticipation of your assistance.
  • ajalwaysus
    Recognized Expert Contributor
    • Jul 2009
    • 266

    #2
    As my first stab at what you want, I would envision a form with all your fields you mentioned, and the fields you don't want to be updated ever be Disabled (Enabled = False) then I would set those fields that can be edited to Locked (Locked = True). Then what you could do is put a double click event on each of those locked fields to set Locked = False only when they are double clicked. Then you could set Locked = True when they tab out, maybe Lost Focus.

    That is my quick 2 cents.

    Let us know if this works for you, or if you were wanting to go a different way.

    -AJ

    Comment

    • ChipR
      Recognized Expert Top Contributor
      • Jul 2008
      • 1289

      #3
      You can certainly use the double click event and just write:
      Code:
      controlName.Locked = False
      From a user's view, though, it would be good to have a note stating that on the form, or a button that unlocks all the appropriate controls on the form. I needed something like this, so I use a button labeled Edit, then once clicked it changes to Done, and locks all the controls when it's clicked again.

      Comment

      • David Wright
        New Member
        • Jan 2009
        • 11

        #4
        Hello Ajalwaysus and ChipR
        Thank you both for your very helpful replies. I drew assistance from a combination of each of your suggestions in order to resolve my problem. I am not sure how to remove the question now that you have very kindly provided me with a solution. Many Many thanks

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32633

          #5
          Originally posted by David Wright
          I am not sure how to remove the question now that you have very kindly provided me with a solution. Many Many thanks
          That's alright David. You can't, and we don't want it removed.

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32633

            #6
            My two-cents worth :
            I would endorse Chip's last point about making the edit state obvious to the user. I use a routine which sets the background colour of the (various sections of the) form.
            Code:
            Private Sub SetBackground(blnEdit As Boolean)
                Dim lngColour As Long
            
                With Me
                    lngColour = IIf(blnEdit, conEditYes, conEditNo)
                    .FormHeader.BackColor = lngColour
                    .Detail.BackColor = lngColour
                    .FormFooter.BackColor = lngColour
                End With
            End Sub
            conEditNo & conEditYes are simply my choice of the colours to use. You can choose any two available really, for as clear, or as subtle, a variation as you like.

            Comment

            Working...