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  

"Me" Variable in Property Sheet



 
 
Thread Tools Display Modes
  #11  
Old November 3rd, 2005, 04:51 PM
Klatuu
external usenet poster
 
Posts: n/a
Default "Me" Variable in Property Sheet

Of course it will work if you use it the way you describe. Would you really
do it that way?

"Douglas J Steele" wrote:

Why do you say that?

I tested the code I suggested to Tom, and it worked fine putting
=ChangeFormColor() in the form's Property Sheet for the Click event of a
button.

An event property can be set to any of:
1) Macro (use "macroname" as the property)
2) Event procedure (use "[Event Procedure]" as the property, and then have a
corresponding Sub in the form's class)
3) User-defined function (use something like "=functionname( )" as the
property)


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Klatuu" wrote in message
...
ChangeFormColor would not be a valid name for an event function.

"Douglas J Steele" wrote:

You can't put a Sub as an Event property, whereas you can put a Function
there.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Klatuu" wrote in message
...
Yep, it works. Looks pretty cool. I did not put the square brackets
around
Me. Curious as to why you made it a function if it returns nothing,

why
not
a Sub? It works fine as a sub.

"Tom via AccessMonster.com" wrote:

Is it possible to use the Me variable in the properties sheet for a
command
button? For example: I want to use :

=ChangeFormColor([Me])

as the On Click event in the properties window instead of:

=ChangeFormColor([Forms]![frmMainForm]).

The function ChangeFormColor is:

Function ChangeFormColor(frm As Form)
On Error Resume Next
frm.Detail.BackColor = RGB(Rnd * 256, Rnd * 256, Rnd * 256)
End Function

Thanks in advance.

Tom


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200511/1







  #12  
Old November 3rd, 2005, 05:02 PM
Dirk Goldgar
external usenet poster
 
Posts: n/a
Default "Me" Variable in Property Sheet

"Klatuu" wrote in message

Of course it will work if you use it the way you describe. Would you
really do it that way?


Sure, I do that quite often. It's a handy way to attach common code to
events, without having to build a separate event procedure for each
object event. And it's convenient to be able to select a bunch of
controls, open their joint property sheet, and enter a function
expression into the same event property for all the controls at once.
The technique also allows you to build "lightweight" (code-free) forms
that still have user-programmed responses to events, although the
practical value of lightweight forms is somewhat debatable.

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

(please reply to the newsgroup)


 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic reference to a sheet xisque Worksheet Functions 4 June 20th, 2005 09:04 PM
Copying multiple sheets from one book 2 another and undertake spec Pank Mehta General Discussion 14 March 16th, 2005 04:41 PM
Property Sheet Access 2003 Ant General Discussion 1 July 20th, 2004 04:03 AM
Relative Reference to another sheet? Gary Worksheet Functions 5 March 23rd, 2004 11:10 PM
Sheet copy with absolute reverence Peo Sjoblom Worksheet Functions 0 November 17th, 2003 08:16 PM


All times are GMT +1. The time now is 04:44 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.