A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

navigating to different records in a read only form



 
 
Thread Tools Display Modes
  #11  
Old January 31st, 2009, 05:35 AM posted to microsoft.public.access.forms,microsoft.public.access.formscoding
Paul
external usenet poster
 
Posts: 68
Default navigating to different records in a read only form

Dirk,

This could be a good solution for me, because I can add code to the combo
box's Exit event to test who the user is. If I want that user to be able to
edit the form, I could just exit the sub. If I don't want them to be able
to edit, then I could set AllowEdits to false.

Thanks

Paul


  #12  
Old January 31st, 2009, 05:35 AM posted to microsoft.public.access.forms,microsoft.public.access.formscoding
Paul
external usenet poster
 
Posts: 68
Default navigating to different records in a read only form

Marsh,

Since I need to have the form change between allowing and not allowing edits
depending on who the user is, I guess I could loop through all the controls,
changing the Locked property as appropriate.

Thanks for the suggestion.

Paul


  #13  
Old January 31st, 2009, 05:45 AM posted to microsoft.public.access.forms,microsoft.public.access.formscoding
Gina Whipp
external usenet poster
 
Posts: 3,500
Default MISTAKE: navigating to different records in a read only form

Paul,

You missed the subject line... I made a mistake. I ran into that problem.
So I created a Security Table 1 = Edit, 2 = View (or Read Only) and 13 =
System Administrator.

Depending on your Security Level and the Tag Property depends on what you
can do but it leaves the unbound combo box in operation. I suppose you can
even do it without worrying about the Tag Property of each field. I put it
in two place because while some might figure out the table they usually
ignore the tag property.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

"Paul" wrote in message
...
Gina,

Can you tell me what VBA code you're using to keep the unbound control
from locking regardless of the value of the AllowEdits property? My
experience is that even if the Locked property of the Combo box is set to
"No," it will not select a new record in the form if AllowEdits is set to
yes.

Thanks

Paul



  #14  
Old January 31st, 2009, 08:16 AM posted to microsoft.public.access.forms,microsoft.public.access.formscoding
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default navigating to different records in a read only form

"Paul" wrote in message
...
Dirk,

This could be a good solution for me, because I can add code to the combo
box's Exit event to test who the user is. If I want that user to be able
to edit the form, I could just exit the sub. If I don't want them to be
able to edit, then I could set AllowEdits to false.



Bear in mind that what I am suggesting is an alternative to Marsh's idea of
locking all the controls. That said, this approach would not need to check
the user's authorization in the Exit event. Instead, it would save the
current state of AllowEdits in the Enter event, and then restore that state
in the Exit event. To do that you'd have to declara a module-level variable
(in the Declarations section of the form's module) to save the state. Here
is how it would work, showing the relevant code from the form's module:

'------ start of example code -----
Dim mblnAllowEdits As Boolean

Private Sub YourComboBox_Enter()

mblnAllowEdits = Me.AllowEdits
Me.AllowEdits = True

End Sub

Private Sub YourComboBox_Exit(Cancel As Integer)

Me.AllowEdits = mblnAllowEdits

End Sub
'------ end of example code -----

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

  #15  
Old January 31st, 2009, 03:52 PM posted to microsoft.public.access.forms,microsoft.public.access.formscoding
Marshall Barton
external usenet poster
 
Posts: 5,361
Default navigating to different records in a read only form

Paul wrote:
Since I need to have the form change between allowing and not allowing edits
depending on who the user is, I guess I could loop through all the controls,
changing the Locked property as appropriate.



Sure. That's where the idea of using the Tag property comes
in.

I use a public procedure in a standard module to take care
of it for any form. Gina's use of different Tag settings
for different types of users is fine if that's your
situation, but a simple edit/no edit procedure, you could
just set the Tag property to LOCK or leave it blank:

Public Sub SetLocks(frm As Form, OnOff As Boolean)
Dim ctl As Control
For Each ctl In frm.Controls
If ctl.Tag = "LOCK" Then ctl.Locked = OnOff
Next ctl
End Sub

Then you can call it from any form to allow changes:
SetLocks Me, False
or to prevent changes:
SetLocks Me, True
Or from a main form to allow changes in a subform:
SetLocks Me.subformcontrol.Form, False
or ...

--
Marsh
MVP [MS Access]
  #16  
Old February 1st, 2009, 02:23 AM posted to microsoft.public.access.forms,microsoft.public.access.formscoding
Paul
external usenet poster
 
Posts: 126
Default navigating to different records in a read only form

Thanks for the sample code, Marsh. It will also help me in another area.

Two questions.

1. The expression "ctl.Locked = OnOff" - I haven't seen that before. Is
that a toggle switch that turns the Locked property of a control on and off
each time it executes?

2. Using the Tag property to identify which controls should be locked seems
to be a great way to determine which ones are locked if you don't want to
lock all of them. But if you want to lock or unlock all of them at once,
wouldn't it be a valid, and possible simpler, approach to turn the form's
AllowEdits property on or off, as per Dirk's suggestion?

Paul





  #17  
Old February 1st, 2009, 02:34 AM posted to microsoft.public.access.forms,microsoft.public.access.formscoding
Paul
external usenet poster
 
Posts: 126
Default navigating to different records in a read only form

Thanks for the sample code, Dirk. If I understand it correctly, it's a good
way to control who can edit the records in a form if one group of users can
edit all records in a form, and another group can edit no records in a form.
I can use that in some situations, but in this particular one, I need to
check the users' authorization for each record.

This is a Project Management application, and I want the Project Manager and
Team members to edit their own projects, but not other projects. I have
some forms where users can only see their own projects, but in this
particular form I want everyone to be able to see all projects, but only
edit the ones in which they are on the mamagement team. And so I'm thinking
the best way to do that is to check their authorization status in the
following three events:

1. the form's Load event,
2. the form's OnCurrent event and
3. the selection combo box's Exit event

Does that make sense?

Paul


  #18  
Old February 1st, 2009, 03:08 AM posted to microsoft.public.access.forms,microsoft.public.access.formscoding
Paul
external usenet poster
 
Posts: 126
Default MISTAKE: navigating to different records in a read only form

Thanks for the comments, Gina.

As I mentioned to Dirk in my message of 1/31 5:34 PM, all users can edit
some records in this form's recordset, but not all. Please see that message
form more detail.

I do have a question regarding your Security Table. Is this something you
use as part of the built-in Access security? I've always avoided getting
into Access Security because I've read that it "ranges from the labyrinthine
to the inscrutable."

If it's not part of the built in Access Security, and if it's simply a table
you're using to establish user security levels, could you say a few more
words about how you're using it? For example, are you using DLookup() in
VBA to get into your security table to check authorization levels?

Paul


  #19  
Old February 1st, 2009, 05:29 AM posted to microsoft.public.access.forms,microsoft.public.access.formscoding
Gina Whipp
external usenet poster
 
Posts: 3,500
Default MISTAKE: navigating to different records in a read only form

Paul,

Got a little busy on a project tonight. I will send the details tomorrow.
However, before I run off. I myself do not use Access security. I either
use my one concoction or if my Client has an SQL server and I'm putting the
tables there I use it.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

"Paul" wrote in message
...
Thanks for the comments, Gina.

As I mentioned to Dirk in my message of 1/31 5:34 PM, all users can edit
some records in this form's recordset, but not all. Please see that
message form more detail.

I do have a question regarding your Security Table. Is this something you
use as part of the built-in Access security? I've always avoided getting
into Access Security because I've read that it "ranges from the
labyrinthine to the inscrutable."

If it's not part of the built in Access Security, and if it's simply a
table you're using to establish user security levels, could you say a few
more words about how you're using it? For example, are you using
DLookup() in VBA to get into your security table to check authorization
levels?

Paul



  #20  
Old February 1st, 2009, 06:21 AM posted to microsoft.public.access.forms,microsoft.public.access.formscoding
John W. Vinson
external usenet poster
 
Posts: 18,261
Default MISTAKE: navigating to different records in a read only form

On Sat, 31 Jan 2009 18:08:20 -0800, "Paul" wrote:

I do have a question regarding your Security Table. Is this something you
use as part of the built-in Access security? I've always avoided getting
into Access Security because I've read that it "ranges from the labyrinthine
to the inscrutable."


If you would like to investigate it - and if you don't have A2007 from which
it's been removed - check out the Microsoft Access 2000 Security FAQ:

http://support.microsoft.com/kb/207793/en-us
--

John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:30 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.