Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Lock Controls

Posted on 2009-05-04
9
Medium Priority
?
995 Views
Last Modified: 2012-05-06
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
Comment
Question by:mato01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 24296565

If mycheck3 = "" Then
   Me.AllowEdits = True
0
 

Author Comment

by:mato01
ID: 24297452
Changed to
If mycheck3 = " " Then
    Me.AllowEdits = True

Did not work.  All the fields remain locked.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 24297609
my code is

 If mycheck3 = "" Then   ' < no space

yours

If mycheck3 = " " Then
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:mato01
ID: 24298114
Did not work

If mycheck3 = "" Then
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 24298294
try this

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

    Me.AllowEdits = True
0
 

Author Comment

by:mato01
ID: 24298574
No that did not work. It seems like it once its locked it will not unlock.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 24299126
can you upload your db?

check Attach File below..
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 24303671
btw, where are you calling the codes?

you should call the codes in the *open event* of the form.
0
 

Accepted Solution

by:
mato01 earned 0 total points
ID: 24307376
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question