Solved

Lock Controls

Posted on 2009-05-04
9
946 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 119

Expert Comment

by:Rey Obrero
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 119

Expert Comment

by:Rey Obrero
ID: 24297609
my code is

 If mycheck3 = "" Then   ' < no space

yours

If mycheck3 = " " Then
0
 

Author Comment

by:mato01
ID: 24298114
Did not work

If mycheck3 = "" Then
0
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 
LVL 119

Expert Comment

by:Rey Obrero
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 119

Expert Comment

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

check Attach File below..
0
 
LVL 119

Expert Comment

by:Rey Obrero
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now