[AccessD] Deleting an Entire Module Procedure via code

Michael R Mattys michael.mattys at adelphia.net
Tue Mar 18 08:19:00 CST 2003


John,

This might help a little bit

Mike Mattys
www.mattysconsulting.com

'-----------------------------------------

Private Function FindDelete(strModuleName As String, strSearchText As
String) As Boolean
'
' Mattys Consulting 2003
' Returns True if successful in deleting the line
' This is ONLY useful for ONE-LINERS - the find method cannot find chr(13)
or chr(10)
'
Dim mdl As Module
Dim lngSLine As Long, lngSCol As Long
Dim lngELine As Long, lngECol As Long
Dim strLine As String, strNewLine As String
Dim intChr As Integer, intBefore As Integer, intAfter As Integer
Dim strLeft As String, strRight As String
DoCmd.OpenModule strModuleName
Set mdl = Modules(strModuleName)

If mdl.Find(strSearchText, lngSLine, lngSCol, lngELine, lngECol) Then
    ' Store text of line containing string.
    strLine = mdl.Lines(lngSLine, Abs(lngELine - lngSLine) + 1)
    mdl.DeleteLines lngSLine, 1
    FindDelete = True
Else
    FindDelete = False
End If
Exit_FindDelete:
    Exit Function
Error_FindDelete:
MsgBox Err & ": " & Err.Description
FindDelete = False
    Resume Exit_FindDelete
End Function




More information about the AccessD mailing list