Solved

Lock Controls

Posted on 2009-05-04
9
981 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
  • 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
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 …
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

763 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