Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 11-08-2018, 08:51 PM   #1
tonez90
Newly Registered User
 
Join Date: Sep 2008
Posts: 33
Thanks: 1
Thanked 6 Times in 6 Posts
tonez90 is on a distinguished road
Change Function name in event in form design

Hi I have allocated a function (event) to a control on a form (i.e. =PopupCalendar([Screen].[ActiveControl]) on the event 'On Dbl Click').

The issue is that the database is quite large and the function is used on a lot of forms. I want to rename the function to say fn_popupCalendar to make it a bit more readable.

So I am wondering if there a module or similar I could use to change the event name on each form property without having to open in design mode and physically change for every occurrence?

Regards
Tony

tonez90 is offline   Reply With Quote
Old 11-08-2018, 10:33 PM   #2
nhorton79
Newly Registered User
 
Join Date: Aug 2015
Posts: 108
Thanks: 12
Thanked 13 Times in 13 Posts
nhorton79 is on a distinguished road
Re: Change Function name in event in form design

There are other special addons and tools that allow you to do things like this among other things.

However the easiest way is to use Find & Replace. It should be under the Edit menu in the VBA editor. Or you can use Ctrl + F to access the Find pop up and then click the Replace tab.

Set the existing function name in the find box and the new function name in the Replace box.
Then select the Current Project (I think itís what itís called) radio button, instead of Current Module.

You can then either click Replace All, or try clicking Find Next and then if it matches the function name then click Replace (a bit slower, but allows you check youíre replacing the right entries).


Sent from my iPhone using Tapatalk
nhorton79 is offline   Reply With Quote
Old 11-08-2018, 11:03 PM   #3
MickJav
Newly Registered User
 
Join Date: Nov 2005
Location: Margate
Posts: 1,000
Thanks: 72
Thanked 49 Times in 42 Posts
MickJav will become famous soon enough
Re: Change Function name in event in form design

Don't think Find/replace will work on all forms contol properties as it looks like that's where the call seems to be you would have to change the function name in the module then open each form and edit the property this can be done in code but i susspect it is above your lvl im just off to work so maybe somebody else will be able to help you.

__________________
All open code examples and free projects are only available from:

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Creating a new project then add styles to it download open code example from:

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
MickJav is offline   Reply With Quote
Old 11-08-2018, 11:08 PM   #4
arnelgp
error reading drive A:
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 8,569
Thanks: 68
Thanked 2,745 Times in 2,630 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Change Function name in event in form design

rename first your function.
on a module paste this and run:
Code:
Public Function fnAllForm()
    Dim frm As AccessObject
    Dim ctl As Control
    Dim thisForm As Form
    For Each frm In CurrentProject.AllForms
        DoCmd.OpenForm frm.Name, acDesign, , , , acHidden
        Set thisform = Forms(frm.Name)
        For Each ctl In thisform
            If TypeOf ctl Is TextBox Then
                If ctl.ControlSource = "=PopupCalendar([Screen].[ActiveControl])" Then
                    ctl.ControlSource = "=fn_popupCalendar([Screen].[ActiveControl])"
                End If
            End If
        Next
        DoCmd.Close acForm, frm.Name, acSaveYes
    Next
End Function
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
The Following User Says Thank You to arnelgp For This Useful Post:
Gasman (11-09-2018)
Old 11-09-2018, 12:54 AM   #5
nhorton79
Newly Registered User
 
Join Date: Aug 2015
Posts: 108
Thanks: 12
Thanked 13 Times in 13 Posts
nhorton79 is on a distinguished road
Re: Change Function name in event in form design

Whoops sorry didnít see control source..,


Sent from my iPhone using Tapatalk

nhorton79 is offline   Reply With Quote
Reply

Tags
event , function , module , rename

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Howto change the event function name carlton Modules & VBA 21 10-30-2018 07:46 PM
Form design help for event meeting schedule gotlength Forms 2 09-22-2015 05:52 PM
Cannot change a form's Height at Design Time byTimber General 4 04-19-2012 03:31 AM
On form change record function? Problem hiding/showing boxes on record change vinzz Modules & VBA 2 04-28-2008 05:56 AM
On change event in form maacky99 Forms 2 09-29-2005 10:59 AM




All times are GMT -8. The time now is 07:10 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World