Solved

Lock Controls

Posted on 2009-05-04
9
988 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
Industry Leaders: 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
managing events in  the webrowser control 14 66
Create a varying recordset 5 51
Cant delete records in query 8 47
MS Access vba Print  PDF First page only 16 31
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

739 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