Welcome to the { mindfrost82.com } forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > MS Office > Access

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-12-2008, 02:36 PM
=?Utf-8?B?cmVtbW9ucw==?=
 
Posts: n/a
Record Editing - Another question

I'm sorry, I have one more issue regarding this post. As the code begins to
loop
through the controls, the control on the subform that has the focus will not
allow me to change its enabled property. I tried creating a dummy control
and setting the focus to that but that doesn't seem to work either. I may be
being too particular about this but, I have several subforms and I'm trying
not to have to fully qualify each subform before running the for each loop to
search for the tag property on the controls. Here's a little snippet of the
code I'm using:
frmEditProjects is the form, frmProjects is the first subform, and the
tabcontrol resides there with more subforms on each tab. By the way, there
are a couple of subforms within those subforms.

Dim ctl As Control
Dim subctl As Control
Dim nextsubctl As Control
Dim strSubFormName As String
Dim strNextSubFormName As String

For Each ctl In Form_frmProjects.Controls
If ctl.Tag = "LockMe" Then
Form_frmProjects.TxtSetFocus.SetFocus
ctl.Locked = True
ctl.Enabled = False
End If
Select Case ctl.ControlType
Case acSubform
strSubFormName = ctl.Name
ctl.SetFocus
For Each subctl In
Form_frmEditProjects.frmProjects.Form(strSubFormNa me).Controls
If subctl.Tag = "LockMe" Then
subctl.Locked = True
subctl.Enabled = False
End If
Select Case subctl.ControlType
Case acSubform
subctl.SetFocus
strNextSubFormName = subctl.Name
For Each nextsubctl In
Form_frmProjects.Form(strSubFormName).Form(strNext SubFormName).Controls
'For Each subthreectl In
Form_frmEditProjects.frmProjects.Form(strSubFormNa me).Form(strNextSubFormName).Controls
If nextsubctl.Tag = "LockMe" Then
nextsubctl.Locked = True
nextsubctl.Enabled = False
End If
Next nextsubctl
End Select
Next subctl
End Select
Next ctl
End Sub

"remmons" wrote:

> It looks like this will work perfectly! Thank you so much!
>
> "Ken Sheridan" wrote:
>
> > First set the Tag property of each relevant control in the form and subform
> > you want to prevent the user from editing to:
> >
> > LockMe
> >
> > Then in the form's Open event procedure put:
> >
> > Dim frm As Form
> > Dim ctrl As Control
> >
> > For Each ctrl In Me.Controls
> > If ctrl.Tag = "LockMe" Then
> > ctrl.Locked = True
> > ctrl.Enabled = False
> > End If
> > Next ctrl
> >
> > Set frm = Me.YourSubformControl.Form
> >
> > For Each ctrl In frm.Controls
> > If ctrl.Tag = "LockMe" Then
> > ctrl.Locked = True
> > ctrl.Enabled = False
> > End If
> > Next ctrl
> >
> > where YourSubformControl is the name of the subform control in the parent
> > form's Controls collection which houses the subform.
> >
> > By both locking and disabling the controls their appearance remains
> > unchanged but the user cannot even move focus to them. Any controls not
> > tagged as LockMe will be unaffected, so if you have unbound controls such as
> > a navigational combo box, which you want available to all users these will
> > still operate.
> >
> > In the procedure executed following a user's entry of a correct password do
> > the same, but this time setting the Locked property to False and the Enabled
> > property to True.
> >
> > The form's recordset must be updatable and the AllowEdits property True of
> > course, but you'll presumably want to set its AllowDeletions property to
> > False by default, and only to True if the user enters a correct password, and
> > possibly not even then.
> >
> > Ken Sheridan
> > Stafford, England
> >
> > "remmons" wrote:
> >
> > > I have a form with subforms containing data linked by a primary key. I would
> > > like to keep the user from making changes to the records unless they enter a
> > > password. My problem is that when I make the master form not editable (using
> > > recordset type = snapshot or allowedits = false) any of the subforms that
> > > don't contain data appear blank. The controls don't even show up. The
> > > master form also contains some data so notlocking it down is not an option
> > > either. Is there any way around this or am I missing something? Thanks for
> > > your help!

> >


Reply With Quote
  #2 (permalink)  
Old 08-12-2008, 03:01 PM
a a r o n . k e m p f @ g m a i l . c o m
 
Posts: n/a
Re: Record Editing - Another question

you're on the right track-- set the focus somewhere else to disable
the control


On Aug 12, 6:36*am, remmons <remm...@discussions.microsoft.com> wrote:
> I'm sorry, I have one more issue regarding this post. *As the code begins to
> loop
> through the controls, the control on the subform that has the focus will not
> allow me to change its enabled property. *I tried creating a dummy control
> and setting the focus to that but that doesn't seem to work either. I maybe
> being too particular about this but, I have several subforms and I'm trying
> not to have to fully qualify each subform before running the for each loop to
> search for the tag property on the controls. *Here's a little snippet of the
> code I'm using:
> frmEditProjects is the form, frmProjects is the first subform, and the
> tabcontrol resides there with more subforms on each tab. *By the way, there
> are a couple of subforms within those subforms.
>
> Dim ctl As Control
> Dim subctl As Control
> Dim nextsubctl As Control
> Dim strSubFormName As String
> Dim strNextSubFormName As String
>
> For Each ctl In Form_frmProjects.Controls
> * * If ctl.Tag = "LockMe" Then
> * * * * Form_frmProjects.TxtSetFocus.SetFocus
> * * * * ctl.Locked = True
> * * * * ctl.Enabled = False
> * * End If
> * * Select Case ctl.ControlType
> * * Case acSubform
> * * strSubFormName = ctl.Name
> * * ctl.SetFocus
> * * * * For Each subctl In
> Form_frmEditProjects.frmProjects.Form(strSubFormNa me).Controls
> * * * * * * If subctl.Tag = "LockMe" Then
> * * * * * * subctl.Locked = True
> * * * * * * subctl.Enabled = False
> * * * * * * End If
> * * * * * * Select Case subctl.ControlType
> * * * * * * Case acSubform
> * * * * * * subctl.SetFocus
> * * * * * * strNextSubFormName = subctl.Name
> * * * * * * * * For Each nextsubctl In
> Form_frmProjects.Form(strSubFormName).Form(strNext SubFormName).Controls
> * * * * * * * * 'For Each subthreectl In
> Form_frmEditProjects.frmProjects.Form(strSubFormNa me).Form(strNextSubFormName).Controls
> * * * * * * * * * * If nextsubctl.Tag = "LockMe" Then
> * * * * * * * * * * nextsubctl.Locked = True
> * * * * * * * * * * nextsubctl.Enabled = False
> * * * * * * * * * * End If
> * * * * * * * * Next nextsubctl
> * * * * * * End Select
> * * * * Next subctl
> * * End Select
> Next ctl
> End Sub
>
> "remmons" wrote:
> > It looks like this will work perfectly! *Thank you so much!

>
> > "Ken Sheridan" wrote:

>
> > > First set the Tag property of each relevant control in the form and subform
> > > you want to prevent the user from editing to:

>
> > > LockMe

>
> > > Then in the form's Open event procedure put:

>
> > > * * Dim frm As Form
> > > * * Dim ctrl As Control

>
> > > * * For Each ctrl In Me.Controls
> > > * * * * If ctrl.Tag = "LockMe" Then
> > > * * * * * * ctrl.Locked = True
> > > * * * * * * ctrl.Enabled = False
> > > * * * * End If
> > > * * Next ctrl

>
> > > * * Set frm = Me.YourSubformControl.Form

>
> > > * * For Each ctrl In frm.Controls
> > > * * * * If ctrl.Tag = "LockMe" Then
> > > * * * * * * ctrl.Locked = True
> > > * * * * * * ctrl.Enabled = False
> > > * * * * End If
> > > * * Next ctrl

>
> > > where YourSubformControl is the name of the subform control in the parent
> > > form's Controls collection which houses the subform.

>
> > > By both locking and disabling the controls their appearance remains
> > > unchanged but the user cannot even move focus to them. *Any controls not
> > > tagged as LockMe will be unaffected, so if you have unbound controls such as
> > > a navigational combo box, which you want available to all users thesewill
> > > still operate.

>
> > > In the procedure executed following a user's entry of a correct password do
> > > the same, but this time setting the Locked property to False and the Enabled
> > > property to True.

>
> > > The form's recordset must be updatable and the AllowEdits property True of
> > > course, but you'll presumably want to set its AllowDeletions propertyto
> > > False by default, and only to True if the user enters a correct password, and
> > > possibly not even then.

>
> > > Ken Sheridan
> > > Stafford, England

>
> > > "remmons" wrote:

>
> > > > I have a form with subforms containing data linked by a primary key.. *I would
> > > > like to keep the user from making changes to the records unless they enter a
> > > > password. *My problem is that when I make the master form not editable (using
> > > > recordset type = snapshot or allowedits = false) any of the subforms that
> > > > don't contain data appear blank. *The controls don't even show up.. *The
> > > > master form also contains some data so notlocking it down is not anoption
> > > > either. *Is there any way around this or am I missing something? *Thanks for
> > > > your help!


Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > MS Office > Access


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:25 PM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0


Sponsors:
Marketing | Cash ISA | Internet Advertising | Loans | Loans



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114