mato01
asked on
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
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
ASKER
Changed to
If mycheck3 = " " Then
Me.AllowEdits = True
Did not work. All the fields remain locked.
If mycheck3 = " " Then
Me.AllowEdits = True
Did not work. All the fields remain locked.
my code is
If mycheck3 = "" Then ' < no space
yours
If mycheck3 = " " Then
If mycheck3 = "" Then ' < no space
yours
If mycheck3 = " " Then
ASKER
Did not work
If mycheck3 = "" Then
If mycheck3 = "" Then
try this
If isNull(mycheck3) or len(mycheck3 & "")=0 then
Me.AllowEdits = True
If isNull(mycheck3) or len(mycheck3 & "")=0 then
Me.AllowEdits = True
ASKER
No that did not work. It seems like it once its locked it will not unlock.
can you upload your db?
check Attach File below..
check Attach File below..
btw, where are you calling the codes?
you should call the codes in the *open event* of the form.
you should call the codes in the *open event* of the form.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If mycheck3 = "" Then
Me.AllowEdits = True