Group:  Microsoft Access ยป microsoft.public.access.forms
Thread: format fields with a button

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

format fields with a button
slreilly 29.08.2006 15:57:02
I've found some code here that allows me to lock & unlock forms with a button
- that part works great, but I'd like to change the format of the fields so
it's obvious which state it's in. i.e., greyed-out for locked. Can I add
something to this code (from Allen Browne originally, thanks allen!) to do
that?

Private Sub cmdLock_Click()
Me.Refresh
Dim bAllow As Boolean
bAllow = Not Me.AllowEdits
Me.AllowEdits = bAllow
Me.AllowAdditions = bAllow
Me.AllowDeletions = bAllow
Me.cmdLock.Caption = IIf(bAllow, "&Lock", "Un&Lock")
End Sub

I'm new to VBA but I can paste & clip with the best of them. So far so good.
Thanks,
Seana

Re: format fields with a button
"Allen Browne" <AllenBrowne[ at ]SeeSig.Invalid> 29.08.2006 16:26:33
Not simple. You would need to set the Enabled property of the controls, or
meddle with the ForeColor and BackColor properties.

How about adding a transparent rectangle with (say) a red border, and size
it so it fits around the edge of the Detail section of your form? Make it
Visible when locked, and not visible with unlocked. It's a pretty good
visual clue for the user. That way you have just one more line of code to
add:
Me.rctLock.Visible = Not bAllow
where "rctLock" is the name of the red rectangle.

There's a screenshot of the concept here:
http://allenbrowne.com/ser-56.html
(though the article is describing a more advanced solution for this issue.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"slreilly" <slreilly[ at ]discussions.microsoft.com> wrote in message
news:BA87E2A3-CF05-42CD-9807-2D0291A44C11[ at ]microsoft.com...
[Quoted Text]
> I've found some code here that allows me to lock & unlock forms with a
> button
> - that part works great, but I'd like to change the format of the fields
> so
> it's obvious which state it's in. i.e., greyed-out for locked. Can I add
> something to this code (from Allen Browne originally, thanks allen!) to do
> that?
>
> Private Sub cmdLock_Click()
> Me.Refresh
> Dim bAllow As Boolean
> bAllow = Not Me.AllowEdits
> Me.AllowEdits = bAllow
> Me.AllowAdditions = bAllow
> Me.AllowDeletions = bAllow
> Me.cmdLock.Caption = IIf(bAllow, "&Lock", "Un&Lock")
> End Sub
>
> I'm new to VBA but I can paste & clip with the best of them. So far so
> good.
> Thanks,
> Seana
>


Re: format fields with a button
slreilly 21.09.2006 02:16:02
(I don't think I ever responded to you).
Just wanted to say thanks. this works like a charm.

certainly beats launching an exact duplicate of a locked form on top of
itself with the controls enabled & colored differently (which was my Plan B).

seana


"Allen Browne" wrote:

[Quoted Text]
> Not simple. You would need to set the Enabled property of the controls, or
> meddle with the ForeColor and BackColor properties.
>
> How about adding a transparent rectangle with (say) a red border, and size
> it so it fits around the edge of the Detail section of your form? Make it
> Visible when locked, and not visible with unlocked. It's a pretty good
> visual clue for the user. That way you have just one more line of code to
> add:
> Me.rctLock.Visible = Not bAllow
> where "rctLock" is the name of the red rectangle.
>
> There's a screenshot of the concept here:
> http://allenbrowne.com/ser-56.html
> (though the article is describing a more advanced solution for this issue.)
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "slreilly" <slreilly[ at ]discussions.microsoft.com> wrote in message
> news:BA87E2A3-CF05-42CD-9807-2D0291A44C11[ at ]microsoft.com...
> > I've found some code here that allows me to lock & unlock forms with a
> > button
> > - that part works great, but I'd like to change the format of the fields
> > so
> > it's obvious which state it's in. i.e., greyed-out for locked. Can I add
> > something to this code (from Allen Browne originally, thanks allen!) to do
> > that?
> >
> > Private Sub cmdLock_Click()
> > Me.Refresh
> > Dim bAllow As Boolean
> > bAllow = Not Me.AllowEdits
> > Me.AllowEdits = bAllow
> > Me.AllowAdditions = bAllow
> > Me.AllowDeletions = bAllow
> > Me.cmdLock.Caption = IIf(bAllow, "&Lock", "Un&Lock")
> > End Sub
> >
> > I'm new to VBA but I can paste & clip with the best of them. So far so
> > good.
> > Thanks,
> > Seana
> >
>
>
>

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net