Unlock Button and Status Field to Header (1 Viewer)

billgyrotech

Banned
Local time
Today, 07:19
Joined
Apr 18, 2013
Messages
258
Hi,


I cut and pasted the 'Unlock' button and 'Status' field to the header section of my form AFRs. They were in the main detail area before.



Why doesn't the 'Unlock' button function now? It is supposed to call for a password and unlock the records by changing the Status field to "Open".


Does anyone know how to make this button function again?


Thank you in advance for your help,
Bill
 
Last edited:

NauticalGent

Ignore List Poster Boy
Local time
Today, 08:19
Joined
Apr 27, 2015
Messages
6,286
When you copy a control, you do not copy the name of the control or the associated event code. Easiest way to do this is open up the VBA IDE by using the properties of the control. You will see the old code somewhere in the Form’s Class Module. Cut an paste it to the new control.
 

Gasman

Enthusiastic Amateur
Local time
Today, 12:19
Joined
Sep 21, 2011
Messages
14,051
I cannot read the DB as I only have 2007.

I would put a breakpoint in the code and see what that produces.

I would hazard a guess that the event is not pointing to the code after the move.?
 

billgyrotech

Banned
Local time
Today, 07:19
Joined
Apr 18, 2013
Messages
258
Thank you NauticalGent it works!


When I change from Open to Closed in the Status field the fields aren't locked. Is there an After Update that I need to do?
 

NauticalGent

Ignore List Poster Boy
Local time
Today, 08:19
Joined
Apr 27, 2015
Messages
6,286
Thank you NauticalGent it works!


When I change from Open to Closed in the Status field the fields aren't locked. Is there an After Update that I need to do?

Happy to help. Use the ode you had before that locked the fields in the button’s On_Click event.
 

Gasman

Enthusiastic Amateur
Local time
Today, 12:19
Joined
Sep 21, 2011
Messages
14,051
Thank you NauticalGent it works!


When I change from Open to Closed in the Status field the fields aren't locked. Is there an After Update that I need to do?

Depending on what you have in the Current event, you could just call that if that is where the previous code was placed?.?
 

billgyrotech

Banned
Local time
Today, 07:19
Joined
Apr 18, 2013
Messages
258
I didn't realize it wasn't working properly before I moved them to the header.


It should lock the fields after updating the Status field but it isn't doing so until I exit the record and come back.


Is there a way to achieve locking the fields when changing the Status field to "Closed"?
 

Gasman

Enthusiastic Amateur
Local time
Today, 12:19
Joined
Sep 21, 2011
Messages
14,051
I didn't realize it wasn't working properly before I moved them to the header.


It should lock the fields after updating the Status field but it isn't doing so until I exit the record and come back.


Is there a way to achieve locking the fields when changing the Status field to "Closed"?

Place a call to the form current event in the afterupdate event of the status control. Again that is assuming that is where the code exists for locking the controls, else call that event or duplicate the code.?

Personally I would not duplicate the code as if you need to change it, you need to change it in two places now.?
 

billgyrotech

Banned
Local time
Today, 07:19
Joined
Apr 18, 2013
Messages
258
Mr. Gasman I am sorry but unsure how to do that. Can you check the file?
 

Gasman

Enthusiastic Amateur
Local time
Today, 12:19
Joined
Sep 21, 2011
Messages
14,051
Mr. Gasman I am sorry but unsure how to do that. Can you check the file?

No I can't, sorry.
My version of Access will not read your DB.
Locate the After Update event of the status control in design view and enter

Code:
Call Form_Current
 

billgyrotech

Banned
Local time
Today, 07:19
Joined
Apr 18, 2013
Messages
258
Thanks it does make the 'Unlock' button reappear but it isn't locking the fields when I change the Status to "Closed".
 

billgyrotech

Banned
Local time
Today, 07:19
Joined
Apr 18, 2013
Messages
258
Okay thanks again Mr. Gasman I will check back later if someone replies.



Cheers!
 

Users who are viewing this thread

Top Bottom