Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable Edits / Additions / Deletions Combo Box Problem

Status
Not open for further replies.

trevorwilliams2

Programmer
Mar 3, 2003
107
US
I have a group of users that I want to limit to view only.
Run reports, filter screen data.

I want to do this without using Access Security.

It is pretty simple for me to set my form properties to disable Edits, Additions, Deletions.

The problem is that the main navigation for my forms is accomplished through the use of combo boxes and when disable edits is selected the combo box no longers works.

Does anybody know a way around this? Or maybe a better way of accomplishing what I am after?

DB: Access 2003
 
Consider enabling or disabling individual controls. I would select all of the controls that should be disabled and update their tag property to "Lock". Then use code in the On Open event of the form like:
Code:
Public Function LockMe(booLock as Boolean)
  Dim ctl As Control
  For Each ctl in Me.Controls
    If ctl.Tag = "Lock" Then
      ctl.Enabled = booLock
    End If
  Next
End Function

Duane
Hook'D on Access
MS Access MVP
 
Locking or disabling anything in the database that is a text box might work...I just need to find the right way to do it.

That would make a very handy function.The user would still be able to navigate, run reports...just not edit data.

Create a table of enabled / disabled users. user name | disabled y/n
On open lookup the user against the windows logon name
If disabled run the lock out function.





 
This works at the form level, it woould be nice if it could be done for the everything in the db.

Private Sub CommandTest_Click()
If UserLocked = True Then
Dim ctl As control
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
ctl.Locked = True
End If
Next
MsgBox "Done"
End If
End Sub
 
I suppose you could create a generic public function that would accept the form object as an argument. You would still need to call it on the On Open of each different form.

Duane
Hook'D on Access
MS Access MVP
 
This worked out pretty good, but had to add in check boxes, combos and subform. (still a problem on the subforms)

If subformctl.ControlType = acSubform Then
subformctl.Form.AllowEdits = False
subformctl.Form.AllowAdditions = False
subformctl.Form.AllowDeletions = False
End If

putting edit at false for subforms put me back at my original problem, the combos are locked in the subform but the user can navigate from the main menu which should be enough for what is needed. (I hope)

Why OnLoad Vs OnOpen?

 
Why OnLoad Vs OnOpen?
The Load event is fired after the Open event and thus you're sure that all the controls are loaded.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top