Hello folks,
I inherited a 3rd party commercial app that uses currentuser() to gather the /wrkgrp users' names for an [updated by] and [entered by] field to audit record changes. As this app was moved to an accdb against sql server this function no longer works. (Everyone is now "Admin")
basically this is what is currently in place:
...after I (with help from this board!) created a module that will pull the logged-in-to-windows user, I wish to replace the above use of CurrentUser() with another function "fOSUserName" so the user's names are valued for these fields.
Now the tedious part...
Is there an en masse way to find/replace code strings from the many, many VBA projects?
This application is pretty big. It would take me all day to make the changes - and worse, the code is not very consistent - so I would likely miss some.
QUESTION: Is there some way I can scour the vba project and find all uses of the CurrentUser() and replace with "fOSUserName" ?
I see that I can open the project explorer and Ctrl-F through each opened project piece - but there are about two hundred or so bits, and being a whiny punk, I don't want to have to cycle through a manual find and replace effort that would take many hours.
Is there a better way to approach this? Perhaps a magical way to export out the vba to a single area where I can make these changes - that will retain form after I push the updates back?
Thoughts? Magicians? Folks who know more than me and can lend me a hand with a better approach?
Thanks!
-Matt G.
I inherited a 3rd party commercial app that uses currentuser() to gather the /wrkgrp users' names for an [updated by] and [entered by] field to audit record changes. As this app was moved to an accdb against sql server this function no longer works. (Everyone is now "Admin")
basically this is what is currently in place:
Code:
If IsNull(Me![Updated By]) Then
Me![Entered By] = CurrentUser()
Me![Date Entered] = Date
End If
Me![Updated By] = CurrentUser()
Me![Date Updated] = Date
Exit Sub
Now the tedious part...
Is there an en masse way to find/replace code strings from the many, many VBA projects?
This application is pretty big. It would take me all day to make the changes - and worse, the code is not very consistent - so I would likely miss some.
QUESTION: Is there some way I can scour the vba project and find all uses of the CurrentUser() and replace with "fOSUserName" ?
I see that I can open the project explorer and Ctrl-F through each opened project piece - but there are about two hundred or so bits, and being a whiny punk, I don't want to have to cycle through a manual find and replace effort that would take many hours.
Is there a better way to approach this? Perhaps a magical way to export out the vba to a single area where I can make these changes - that will retain form after I push the updates back?
Thoughts? Magicians? Folks who know more than me and can lend me a hand with a better approach?
Thanks!
-Matt G.
Last edited: