Access enable use of only unbound parts of form

Hi

I have an Access form that is bound to two tables "Sales Orders" and "Sales Order Details". The only unbound part of the form
is circled in red in the first image. I have disabled editing the form using the properties shown in the second image. Unfortunately
this stops me from using the unbound text box on the right. How do I enable the use of this box and "Invoice" button only and
prevent the user from editing the bound parts of the form

1
2
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fabrice LambertFabrice LambertCommented:
Hi,

Set your form allow edition property to Yes, and set your controls enabled property to No.
0
Juan OcasioApplication DeveloperCommented:
I agree with Fabrice.  We do this on several of our forms where we do not want the end user to modify data.  We use something similar to this on Form Load (you could use On Current):
Me.AllowAdditions = False
Dim ctl As Control
For Each ctl In Me.Controls
     If TypeOf ctl Is TextBox Or TypeOf ctl Is ComboBox Then
        ctl.Locked = True
        ctl.BackColor = 8454143
    End If
Next

Open in new window


In your case your condition could be something like
If ctl.Name <> "txtFreight"  Then

Open in new window

or something similar
0
PatHartmanCommented:
This is the sub I use.  Put it in a standard code module so it will be available for EVERY form.  Use it in the Form's Current Event.    The code toggles the locked property of the form.  If you want to OVERRIDE any particular control so that it is always locked or always unlocked, use the tag property and set it to "Lock" or "NoLock".  In your case, you always want these controls to be unlocked, so use "NoLock" as the tag property for each of these controls.

Using this sub allows you to use the same form for view only users as you use for those able to update.
Public Sub LockControls(frm As Form, bLock As Boolean)
    Dim ctl As Control
    For Each ctl In frm.Controls
    Select Case ctl.ControlType
        Case acTextBox, acComboBox, acListBox, acCheckBox
            Select Case ctl.Tag
                Case "NoLock"
                    ctl.Locked = False
                Case "Lock"
                    ctl.Locked = True
                Case Else
                    ctl.Locked = bLock         'toggle locks
            End Select
        Case acCommandButton
            Select Case ctl.Tag
                Case "NoLock"
                    ctl.Enabled = True
                Case "Lock"
                    ctl.Enabled = False
                Case Else
                    ctl.Enabled = Not bLock         'toggle locks
            End Select
    End Select
Next ctl
Set ctl = Nothing
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much
0
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Hi Pat. How do I call that procedure. The following didn't work

LockControls(Forms("Sales Orders", True)
LockControls(Me.Form, True)
LockControls(Me,True)
0
PatHartmanCommented:
Call LockControls(Me, True)

OR

Call LockControls(Me, False)

You are passing in an OBJECT rather than a name.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.