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
  #21  
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












  #22  
Old October 22nd, 2004, 12:26 AM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

Regular module means a module that you create from the database window.

To use the function as the event handler, type this in the property box next
to After Update event on the Event tab for the textbox's Properties:

=MyUcase()

--

Ken Snell
MS ACCESS MVP

"Trina Gray" Trina wrote in message
...
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














  #23  
Old October 22nd, 2004, 12:26 AM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

Regular module means a module that you create from the database window.

To use the function as the event handler, type this in the property box next
to After Update event on the Event tab for the textbox's Properties:

=MyUcase()

--

Ken Snell
MS ACCESS MVP

"Trina Gray" Trina wrote in message
...
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














  #24  
Old October 22nd, 2004, 05:25 PM
Trina Gray
external usenet poster
 
Posts: n/a
Default

Thank you! Thank you! Thank you! I put everything in place per your
instruction and it worked perfectly.

Thanks again,
Trina Gray

"Ken Snell [MVP]" wrote:

Regular module means a module that you create from the database window.

To use the function as the event handler, type this in the property box next
to After Update event on the Event tab for the textbox's Properties:

=MyUcase()

--

Ken Snell
MS ACCESS MVP

"Trina Gray" Trina wrote in message
...
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















  #25  
Old October 22nd, 2004, 06:09 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

You're welcome.

--

Ken Snell
MS ACCESS MVP

"Trina Gray" wrote in message
news
Thank you! Thank you! Thank you! I put everything in place per your
instruction and it worked perfectly.

Thanks again,
Trina Gray

"Ken Snell [MVP]" wrote:

Regular module means a module that you create from the database window.

To use the function as the event handler, type this in the property box

next
to After Update event on the Event tab for the textbox's Properties:

=MyUcase()

--

Ken Snell
MS ACCESS MVP

"Trina Gray" Trina wrote in message
...
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 07:11 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.