Connecting Tech Pros Worldwide Forums | Help | Site Map

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

Newbie
 
Join Date: Jan 2009
Posts: 11
#1: 3 Weeks Ago
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.

Expert
 
Join Date: Jul 2009
Location: KY
Posts: 253
#2: 3 Weeks Ago

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


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
Expert
 
Join Date: Jul 2008
Location: Maryland
Posts: 1,176
#3: 3 Weeks Ago

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


You can certainly use the double click event and just write:
Expand|Select|Wrap|Line Numbers
  1. 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.
Newbie
 
Join Date: Jan 2009
Posts: 11
#4: 3 Weeks Ago

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


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
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,730
#5: 3 Weeks Ago

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


Quote:

Originally Posted by David Wright View Post

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.
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,730
#6: 3 Weeks Ago

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


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.
Expand|Select|Wrap|Line Numbers
  1. Private Sub SetBackground(blnEdit As Boolean)
  2.     Dim lngColour As Long
  3.  
  4.     With Me
  5.         lngColour = IIf(blnEdit, conEditYes, conEditNo)
  6.         .FormHeader.BackColor = lngColour
  7.         .Detail.BackColor = lngColour
  8.         .FormFooter.BackColor = lngColour
  9.     End With
  10. 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.
Reply


Similar Microsoft Access / VBA bytes