[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 996
  • Last Modified:

Lock Controls

Hi
I am trying to lock fields based on a selection from a drop down box.  I created a table, where I tagged the fields I want locked based on the selection. The code locks the fields, it just won't unlock the fields.

This portion does not work.  Is this the wrong syntax?
If mycheck3 Like "" Then
   Me.AllowEdits = True

Any thoughts are appreciated.  Thanks
Dim mycheck3, MyDB1 As Database, MYDBR1 As Recordset
Set MyDB1 = CurrentDb
Set MyDB1 = DBEngine.Workspaces(0).Databases(0)
Set MYDBR1 = MyDB1.OpenRecordset("test_field_locks", DB_OPEN_DYNASET)
    mycheck3 = MYDBR1("Adj_Lock").Value
        If Me.Status = "Submitted" Then
            If mycheck3 Like "LS" Then
                Me.AllowEdits = False
            If mycheck3 Like "" Then
                Me.AllowEdits = True
                Me.Refresh
                
            End If
         End If
    End If
MYDBR1.Close
MyDB1.Close

Open in new window

0
mato01
Asked:
mato01
  • 5
  • 4
1 Solution
 
Rey Obrero (Capricorn1)Commented:

If mycheck3 = "" Then
   Me.AllowEdits = True
0
 
mato01Author Commented:
Changed to
If mycheck3 = " " Then
    Me.AllowEdits = True

Did not work.  All the fields remain locked.
0
 
Rey Obrero (Capricorn1)Commented:
my code is

 If mycheck3 = "" Then   ' < no space

yours

If mycheck3 = " " Then
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
mato01Author Commented:
Did not work

If mycheck3 = "" Then
0
 
Rey Obrero (Capricorn1)Commented:
try this

If isNull(mycheck3) or len(mycheck3 & "")=0 then

    Me.AllowEdits = True
0
 
mato01Author Commented:
No that did not work. It seems like it once its locked it will not unlock.
0
 
Rey Obrero (Capricorn1)Commented:
can you upload your db?

check Attach File below..
0
 
Rey Obrero (Capricorn1)Commented:
btw, where are you calling the codes?

you should call the codes in the *open event* of the form.
0
 
mato01Author Commented:
The information is business sensitive so I can't send you the file.

I've been calling the code in the after update.  I will try the "open event".
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now