Access code to unlock fields after a user is validated.

lbradbury

New Member
Joined
May 14, 2020
Messages
46
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm looking for a solution for a database that I have in which after the form is completed the entry fields are locked to not allow editing. However, in the event an edit is required, I would like a command button to to open a login form (frm_Login) validate username and password (tbl_login) then if validated, then continue to run code below. If not validated the operation cancels and message generates stating so. I'm not sure how to code this.

VBA Code:
Private Sub Command265_Click()

DoCmd.OpenForm "frm_Login"

Me.Buyer.Locked = False
Me.Today_s_Date.Locked = False
Me.Need_By_Date.Locked = False
Me.Detail_Description.Locked = False
Me.Urgent_Rush.Locked = False
Me.Customer_Owned_Property.Locked = False
Me.Free_Sample.Locked = False
Me.Affect_GoodService.Locked = False
Me.Approved_Supplier.Locked = False
Me.Controlled_Unclassfied_Information.Locked = False
Me.CUI_Marked.Locked = False
Me.Document_Specifying_Supplier.Locked = False
Me.Criteria_AS.Locked = False
Me.Supplier_Name.Locked = False
Me.Supplier_Address.Locked = False
Me.Supplier_Contact.Locked = False
Me.Supplier_Website.Locked = False
Me.Supplier_Email.Locked = False
Me.Supplier_Phone.Locked = False
Me.Supplier_Fax.Locked = False
Me.Delivery_Method.Locked = False
Me.Supplier_Deliver.Locked = False
Me.Drawings_Attached.Locked = False
Me.Attached_drawing_Part.Locked = False
Me.Sent_Drawing_Part.Locked = False
Me.Approvals_Required.Locked = False
Me.Spec_Qualifications.Locked = False
Me.CUI_Safegaurd.Locked = False
Me.Supplier_Controls.Locked = False
Me.NDA_Needed.Locked = False
Me.CofC_Required.Locked = False
Me.CofA_Required.Locked = False
Me.SDS_Required.Locked = False
Me.Other_Comments.Locked = False
Me.CustomerSpecified_Supplier.Locked = False
Me.Shipping_Cost.Locked = False
Me.SupportDocs.Locked = False
Me.Drawing_Sent.Locked = False
End Sub
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Wouldn;t be a lot easier to set the Form's AllowEdits to True?
The code to set anything would be in the Frm_Login unless you set some sort of Global variable/TempVar to check?
 
Upvote 0
Wouldn;t be a lot easier to set the Form's AllowEdits to True?
The code to set anything would be in the Frm_Login unless you set some sort of Global variable/TempVar to check?
How do I accomplish what you suggested?
 
Upvote 0
If you put the code in the frmLogin, then you would refer to the fullname of the form Forms! etc and just set the AllowEdits property of that form to False ?
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top