Command button to unlock subform

chrisjames25

Registered User.
Local time
Today, 23:34
Joined
Dec 1, 2014
Messages
404
Hi - Back after a few manic weeks at work with limited time to access.

Trying to create a user friendly database but one that trys to restrict erros as much as possible. The negative of this is that edit some data in database can be slower for the human than it could be designed but that is for the above purpose.

For example i have a category table with a sufrom listing all category names and status. To amend any of the categorys you have to click on the edit buttons which then opens an edit form for you to make the amends to the name or status of category.

Great for making sure person only editing what they intend to but if i want to quick switch 15 category status off not ideal. I would prefer to just unlock the subform and click the relevant status checks (i trust myself for this!!!).

So i have a plan. My plan is to add an unlock cmd button to the header of the subform and when i click it another form pops out asking for a password and when i enter correct password it unlocks the subform. THis is too complicated for me to figure out.

As an alternative i could simply click the unlock and then have textbox become visible for me to enter the password there and then and a confirm button also become visible. Once hit confirm check password is correct and then subform is unlocked and header returns to normal but with an unlocked padlock.

Sorry this is all waffle as i have thought of half this as i have typed. Still gonna post it as it may help someone at some point.

Any thoughts would be great.

1 question would be rather than hard code the password how can i refer to a Tbl_UnlockCodes to check the password is correct. Table will only consist of one password but iut would allow me to change it easily.

Attached image for ease of understanding my waffle.
 

Attachments

  • Capture.PNG
    Capture.PNG
    29.9 KB · Views: 107
put another image there, unlocked padlock.
make its visibile property to No.

on the clicked event of the locked padlock image:

private sub paddlock_click()
Dim strPassword As String
strPassword = InputBox("Enter password to unlock", "Password Required")
' if the password is in table, use DCount
'If DCount("*","PasswordTable","PassWordField=" & Chr(34) & strPassword & Chr(34))>0 then
' unlock the subform
If strPassword = "arnel" Then
Forms!MainFormName!SubformName.Locked = False
MsgBox "subform unlocked"

'change the picture from Locked to Unlocked
Me.paddlock.PictureData = Me.yourUnlockedImage.PictureData
End If
 
Brilliant. I'm impressed after my waffle someone got what i was after. WIll give it a go and report back
 
Having issue with this part of your code

Code:
Forms!MainFormName!SubformName.Locked = False

With my forms it looks like this

Code:
Forms!Frm_CategoryAdd!Frm_CategorySubForm!Locked = False

Should i be referencing the child or the actual subform?
 
Or is the issue i am having that i put the cmd button in the subform?
 
use the Child if it is available.
 

Users who are viewing this thread

Back
Top Bottom