|
Find and Replace for MSAccess queries Ever needed to duplicate a group of MS Access queries and then change a key piece of data in each one? Use this VBA code to do it. |
Public Function fnFindReplace(sQueryName As String, sFind As String, sReplace As String) As Boolean DoCmd.CopyObject , Replace(sQueryName, sFind, sReplace), acQuery,sQueryName CurrentDb.QueryDefs(Replace(sQueryName, sFind, sReplace)).SQL = Replace(CurrentDb.QueryDefs(Replace(sQueryName,sFind,sReplace)).SQL,sFind, sReplace) End Function
Sub Usage() |