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  

Function as event handler



 
 
Thread Tools Display Modes
  #11  
Old October 19th, 2004, 02:57 AM
Dirk Goldgar
external usenet poster
 
Posts: n/a
Default

"Gary Schuldt" wrote in message


(FYI, the plant botanical names, consisting of Family, Genus,
species, and Cultivar have their case rules set by an international
standard. Lucky me! I can auto-correct whatever the user types, at
least as far as case goes.)


That is handy. The names of people are not so easy to get right.

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

(please reply to the newsgroup)


  #12  
Old October 19th, 2004, 06:45 AM
Gary Schuldt
external usenet poster
 
Posts: n/a
Default

names of people

Like e e cummings . . . or my former colleague III (pronounced like the
numeral 3) . . . or my hometown next door nabors the VanTines . . . as
opposed to the von Trapps . . . but all of them would be offended by my
PCase function. Fortunately, the plants are more orderly!

Gary

"Dirk Goldgar" wrote in message
...
"Gary Schuldt" wrote in message


(FYI, the plant botanical names, consisting of Family, Genus,
species, and Cultivar have their case rules set by an international
standard. Lucky me! I can auto-correct whatever the user types, at
least as far as case goes.)


That is handy. The names of people are not so easy to get right.

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

(please reply to the newsgroup)




  #13  
Old October 19th, 2004, 02:08 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

"doh"! Thanks, Doug...got my fingers tongue-tied on this one!

--

Ken Snell
MS ACCESS MVP

"Douglas J. Steele" wrote in message
...
Actually, you need to set the value of Screen.ActiveControl. It doesn't
matter whether or not the function returns a value:

Public Function MyUcase() As String
Screen.ActiveControl.Value = UCase(Screen.ActiveControl.Value)
End Function


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



"Ken Snell [MVP]" wrote in message
...
I believe you must create your own function and call it, not use the
built-in function that requires an argument.

Create this function in a regular module:

Public Function MyUcase() As String
MyUcase = UCase(Screen.ActiveControl.Value)
End Function


Then use MyUcase() as the event handler function.

--

Ken Snell
MS ACCESS MVP

"Gary Schuldt" wrote in message
...
I thought I could code a function reference in the event-handler box

for
a
control, but I'm missing something, since I can't get it to work.

I want to make a text field all upper case AfterUpdate.

The Expression Builder guides me through to yield the entry:

=Ucase([txtFld])

but it doesn't work. When I type lower-case letters into the field

and
tab
out, they remain lower-case.

I know I've seen this done before!

Gary








  #14  
Old October 20th, 2004, 10:01 PM
hermie
external usenet poster
 
Posts: n/a
Default

Hello Group

Maybe wrong thinking or not but why not just format the field which must
have uppercases with

Herman

"Gary Schuldt" wrote in message
...
I thought I could code a function reference in the event-handler box for a
control, but I'm missing something, since I can't get it to work.

I want to make a text field all upper case AfterUpdate.

The Expression Builder guides me through to yield the entry:

=Ucase([txtFld])

but it doesn't work. When I type lower-case letters into the field and

tab
out, they remain lower-case.

I know I've seen this done before!

Gary





  #15  
Old October 21st, 2004, 04:38 AM
Gary Schuldt
external usenet poster
 
Posts: n/a
Default

Herman,

Actually, what I really wanted to do was more complex than that . . . I just
didn't admit it! I had several different controls with different case
requirements, including the need to capitalize the first letter of every
word the user typed in on one of the controls.

So I got what I wanted--a way to manipulate the active control with a
function reference, something I can reuse in the future.

Thanks for your suggestion.

Gary

"hermie" wrote in message
...
Hello Group

Maybe wrong thinking or not but why not just format the field which must
have uppercases with

Herman

"Gary Schuldt" wrote in message
...
I thought I could code a function reference in the event-handler box for

a
control, but I'm missing something, since I can't get it to work.

I want to make a text field all upper case AfterUpdate.

The Expression Builder guides me through to yield the entry:

=Ucase([txtFld])

but it doesn't work. When I type lower-case letters into the field and

tab
out, they remain lower-case.

I know I've seen this done before!

Gary







  #16  
Old October 21st, 2004, 08:19 PM
Trina Gray
external usenet poster
 
Posts: n/a
Default

I cannot get this code to work. Please tell me what I am doing wrong.

I opened the properties for the field that I wish to have converted to
uppercase, Clicked the "..." button on the "After Update" line under "Event"
tab.
Selected "Code Builder" from options.
Pasted the suggested code but it still did not work. Am I supposed to
replace "Screen", "ActiveControl" and/or "Value" with specific information?

Trina Gray


"Gary Schuldt" wrote:

Ah, that's the trick! I remember now:

1. It HAS to be a user function to be used in one-liner event handler
context

2. It doesn't matter what the function value is set to

3. The function code (or something it calls, like a Sub) must set the
value(s) you want.

How COULD I have forgotten?? g

Thanks,

Doug

"Douglas J. Steele" wrote in message
...
Actually, you need to set the value of Screen.ActiveControl. It doesn't
matter whether or not the function returns a value:

Public Function MyUcase() As String
Screen.ActiveControl.Value = UCase(Screen.ActiveControl.Value)
End Function


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



"Ken Snell [MVP]" wrote in message
...
I believe you must create your own function and call it, not use the
built-in function that requires an argument.

Create this function in a regular module:

Public Function MyUcase() As String
MyUcase = UCase(Screen.ActiveControl.Value)
End Function


Then use MyUcase() as the event handler function.

--

Ken Snell
MS ACCESS MVP

"Gary Schuldt" wrote in message
...
I thought I could code a function reference in the event-handler box

for
a
control, but I'm missing something, since I can't get it to work.

I want to make a text field all upper case AfterUpdate.

The Expression Builder guides me through to yield the entry:

=Ucase([txtFld])

but it doesn't work. When I type lower-case letters into the field

and
tab
out, they remain lower-case.

I know I've seen this done before!

Gary









  #17  
Old October 21st, 2004, 08:19 PM
Trina Gray
external usenet poster
 
Posts: n/a
Default

I cannot get this code to work. Please tell me what I am doing wrong.

I opened the properties for the field that I wish to have converted to
uppercase, Clicked the "..." button on the "After Update" line under "Event"
tab.
Selected "Code Builder" from options.
Pasted the suggested code but it still did not work. Am I supposed to
replace "Screen", "ActiveControl" and/or "Value" with specific information?

Trina Gray


"Gary Schuldt" wrote:

Ah, that's the trick! I remember now:

1. It HAS to be a user function to be used in one-liner event handler
context

2. It doesn't matter what the function value is set to

3. The function code (or something it calls, like a Sub) must set the
value(s) you want.

How COULD I have forgotten?? g

Thanks,

Doug

"Douglas J. Steele" wrote in message
...
Actually, you need to set the value of Screen.ActiveControl. It doesn't
matter whether or not the function returns a value:

Public Function MyUcase() As String
Screen.ActiveControl.Value = UCase(Screen.ActiveControl.Value)
End Function


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



"Ken Snell [MVP]" wrote in message
...
I believe you must create your own function and call it, not use the
built-in function that requires an argument.

Create this function in a regular module:

Public Function MyUcase() As String
MyUcase = UCase(Screen.ActiveControl.Value)
End Function


Then use MyUcase() as the event handler function.

--

Ken Snell
MS ACCESS MVP

"Gary Schuldt" wrote in message
...
I thought I could code a function reference in the event-handler box

for
a
control, but I'm missing something, since I can't get it to work.

I want to make a text field all upper case AfterUpdate.

The Expression Builder guides me through to yield the entry:

=Ucase([txtFld])

but it doesn't work. When I type lower-case letters into the field

and
tab
out, they remain lower-case.

I know I've seen this done before!

Gary









  #18  
Old October 21st, 2004, 08:30 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

You don't put the function in the form's module.

Create this function in a regular module:

Public Function MyUcase() As String
Screen.ActiveControl.Value = UCase(Screen.ActiveControl.Value)
End Function

Then use MyUcase() as the event handler function.

--

Ken Snell
MS ACCESS MVP

"Trina Gray" Trina wrote in message
...
I cannot get this code to work. Please tell me what I am doing wrong.

I opened the properties for the field that I wish to have converted to
uppercase, Clicked the "..." button on the "After Update" line under

"Event"
tab.
Selected "Code Builder" from options.
Pasted the suggested code but it still did not work. Am I supposed to
replace "Screen", "ActiveControl" and/or "Value" with specific

information?

Trina Gray


"Gary Schuldt" wrote:

Ah, that's the trick! I remember now:

1. It HAS to be a user function to be used in one-liner event handler
context

2. It doesn't matter what the function value is set to

3. The function code (or something it calls, like a Sub) must set the
value(s) you want.

How COULD I have forgotten?? g

Thanks,

Doug

"Douglas J. Steele" wrote in message
...
Actually, you need to set the value of Screen.ActiveControl. It

doesn't
matter whether or not the function returns a value:

Public Function MyUcase() As String
Screen.ActiveControl.Value = UCase(Screen.ActiveControl.Value)
End Function


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



"Ken Snell [MVP]" wrote in message
...
I believe you must create your own function and call it, not use the
built-in function that requires an argument.

Create this function in a regular module:

Public Function MyUcase() As String
MyUcase = UCase(Screen.ActiveControl.Value)
End Function


Then use MyUcase() as the event handler function.

--

Ken Snell
MS ACCESS MVP

"Gary Schuldt" wrote in message
...
I thought I could code a function reference in the event-handler

box
for
a
control, but I'm missing something, since I can't get it to work.

I want to make a text field all upper case AfterUpdate.

The Expression Builder guides me through to yield the entry:

=Ucase([txtFld])

but it doesn't work. When I type lower-case letters into the

field
and
tab
out, they remain lower-case.

I know I've seen this done before!

Gary











  #19  
Old October 21st, 2004, 08:30 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

You don't put the function in the form's module.

Create this function in a regular module:

Public Function MyUcase() As String
Screen.ActiveControl.Value = UCase(Screen.ActiveControl.Value)
End Function

Then use MyUcase() as the event handler function.

--

Ken Snell
MS ACCESS MVP

"Trina Gray" Trina wrote in message
...
I cannot get this code to work. Please tell me what I am doing wrong.

I opened the properties for the field that I wish to have converted to
uppercase, Clicked the "..." button on the "After Update" line under

"Event"
tab.
Selected "Code Builder" from options.
Pasted the suggested code but it still did not work. Am I supposed to
replace "Screen", "ActiveControl" and/or "Value" with specific

information?

Trina Gray


"Gary Schuldt" wrote:

Ah, that's the trick! I remember now:

1. It HAS to be a user function to be used in one-liner event handler
context

2. It doesn't matter what the function value is set to

3. The function code (or something it calls, like a Sub) must set the
value(s) you want.

How COULD I have forgotten?? g

Thanks,

Doug

"Douglas J. Steele" wrote in message
...
Actually, you need to set the value of Screen.ActiveControl. It

doesn't
matter whether or not the function returns a value:

Public Function MyUcase() As String
Screen.ActiveControl.Value = UCase(Screen.ActiveControl.Value)
End Function


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



"Ken Snell [MVP]" wrote in message
...
I believe you must create your own function and call it, not use the
built-in function that requires an argument.

Create this function in a regular module:

Public Function MyUcase() As String
MyUcase = UCase(Screen.ActiveControl.Value)
End Function


Then use MyUcase() as the event handler function.

--

Ken Snell
MS ACCESS MVP

"Gary Schuldt" wrote in message
...
I thought I could code a function reference in the event-handler

box
for
a
control, but I'm missing something, since I can't get it to work.

I want to make a text field all upper case AfterUpdate.

The Expression Builder guides me through to yield the entry:

=Ucase([txtFld])

but it doesn't work. When I type lower-case letters into the

field
and
tab
out, they remain lower-case.

I know I've seen this done before!

Gary











  #20  
Old October 21st, 2004, 09:55 PM
Trina Gray
external usenet poster
 
Posts: n/a
Default

By regular module are you refering to creating a new module? Please explain
how I "use MyUcase() as the event handler function".

Thanks,
Trina Gray

"Ken Snell [MVP]" wrote:

You don't put the function in the form's module.

Create this function in a regular module:

Public Function MyUcase() As String
Screen.ActiveControl.Value = UCase(Screen.ActiveControl.Value)
End Function

Then use MyUcase() as the event handler function.

--

Ken Snell
MS ACCESS MVP

"Trina Gray" Trina wrote in message
...
I cannot get this code to work. Please tell me what I am doing wrong.

I opened the properties for the field that I wish to have converted to
uppercase, Clicked the "..." button on the "After Update" line under

"Event"
tab.
Selected "Code Builder" from options.
Pasted the suggested code but it still did not work. Am I supposed to
replace "Screen", "ActiveControl" and/or "Value" with specific

information?

Trina Gray


"Gary Schuldt" wrote:

Ah, that's the trick! I remember now:

1. It HAS to be a user function to be used in one-liner event handler
context

2. It doesn't matter what the function value is set to

3. The function code (or something it calls, like a Sub) must set the
value(s) you want.

How COULD I have forgotten?? g

Thanks,

Doug

"Douglas J. Steele" wrote in message
...
Actually, you need to set the value of Screen.ActiveControl. It

doesn't
matter whether or not the function returns a value:

Public Function MyUcase() As String
Screen.ActiveControl.Value = UCase(Screen.ActiveControl.Value)
End Function


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



"Ken Snell [MVP]" wrote in message
...
I believe you must create your own function and call it, not use the
built-in function that requires an argument.

Create this function in a regular module:

Public Function MyUcase() As String
MyUcase = UCase(Screen.ActiveControl.Value)
End Function


Then use MyUcase() as the event handler function.

--

Ken Snell
MS ACCESS MVP

"Gary Schuldt" wrote in message
...
I thought I could code a function reference in the event-handler

box
for
a
control, but I'm missing something, since I can't get it to work.

I want to make a text field all upper case AfterUpdate.

The Expression Builder guides me through to yield the entry:

=Ucase([txtFld])

but it doesn't work. When I type lower-case letters into the

field
and
tab
out, they remain lower-case.

I know I've seen this done before!

Gary












 




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
Browse Button in Access Spammastergrand Running & Setting Up Queries 6 August 31st, 2004 02:39 AM
Using the ADDRESS function embedded in AVERAGE function jawneyc Worksheet Functions 1 August 5th, 2004 01:56 PM
Function autoupdate, relative addressing Thomas Worksheet Functions 2 August 2nd, 2004 03:59 PM
Newbe help - VBA function Kristen Worksheet Functions 2 April 21st, 2004 10:30 PM
Customising the Function Wizard Frank Kabel Worksheet Functions 1 April 20th, 2004 06:46 PM


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