Minggu, 14 Desember 2014

Re: [MS_AccessPros] Re: User clicks the X (close) button on a form in the upper-right hand corner and it closes.

 

Hi Norbert,

In the wonderfulness of Word, the "^p" character string (no quotes) is a paragraph mark.  When I copied my code into Word, I used the double paragraph marks as a unique character string to look for because I didn't want the added "DoEvents" to be appended to the end of an existing line of code as that would cause an error.

I didn't want to remove the double paragraph marks so the replace began with replacing them with them so that I'd retain them.  Then I wanted the "DoEvents" to be on a line by itself so I followed it with the new paragraph mark.

So, here's my test code:

 

Private Sub Form_Open(Cancel As Integer)

 

Dim strQuery As String

 

    On Error GoTo Proc_Err

    cboSnippets = "Access"

 

    strQuery = "SELECT AccessSnippetsIndex.AccSnipDesc, AccessSnippetsIndex.ID FROM AccessSnippetsIndex order by AccessSnippetsIndex.AccSnipDesc;"

    Me.lstSnippetNames.RowSource = strQuery


 

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

Proc_Exit:

    On Error Resume Next

    'Call DoEcho(True)

    Exit Sub

 

Proc_Err:

    'Call LogError(Err.Number, Err.Description, "cmdFilter_Click", mcstrMOD_NAME)

    Resume Proc_Exit

 

End Sub

~~~ end of test and unchanged code ~~~

And here it is after doing the replace in Word.

 

Private Sub Form_Open(Cancel As Integer)

 

DoEvents

 

Dim strQuery As String

 

DoEvents

    On Error GoTo Proc_Err

cboSnippets = "Access"


DoEvents

    strQuery = "SELECT AccessSnippetsIndex.AccSnipDesc, AccessSnippetsIndex.ID FROM AccessSnippetsIndex order by AccessSnippetsIndex.AccSnipDesc;"

    Me.lstSnippetNames.RowSource = strQuery


DoEvents

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

Proc_Exit:

    On Error Resume Next

    'Call DoEcho(True)

    Exit Sub

 

DoEvents

Proc_Err:

    'Call LogError(Err.Number, Err.Description, "cmdFilter_Click", mcstrMOD_NAME)

    Resume Proc_Exit

 

DoEvents

End Sub


~~~~~  end of modified code ~~~~

Caution, look at the results as depending on your code, followup replaces may be needed to remove a "DoEvents" between procedures or functions.  This is easily done with another Replace where "DoEvents^pPrivate" or "DoEvents^pSub " is replaced with "^pPrivate".  or "^pSub " If needed, the word "Private" could be nothing more than "Sub " or "Function".   The VBE doesn't like stuff between an "End Sub" and a new subroutine.  Again, the existing paragraph mark, or new line in the VBE should be retained.

The reason I use Word is because it recognizes the paragraph mark while Notepad++ and other editors I have available do not.  By placing the "DoEvents" on a separate lint by itself, I can easily remove them all from within the VBE if I wish with a simple replace.  The use of the paragraph mark "^p" (no quotes and note the lower case "p") allows me to identify wshere I want the "DoEvents" without hosing ove the existing code. 

Just in case you are wondering, a line of code that is continued to the next line doe not have a paragraph mark between the 2 lines when copied from the VBE into Word.

I hope that this does a better job of explaining this.

Jeff

From: "drnorbert@msn.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com>
To: "MS Access Professionals" <MS_Access_Professionals@yahoogroups.com>
Sent: Sunday, December 14, 2014 9:29:45 AM
Subject: Re: [MS_AccessPros] Re: User clicks the X (close) button on a form in the upper-right hand corner and it closes.

 

Hi Jeff,

Thanks for your detail steps.

I am working now to remove of all the comments with FMS CodeTools.

I found 579 textbox:  ^p^p.

Can please clarify what characters I should replace  ^p^p


4.  I'd then enter the following into the "Replace with"{ Textbox: ^p^pDoEvents^p


Regards

Norbert  




--
---

Jeffrey Park Jones
Excel, Access, Word, Office Expert
Excel and Access, LLC®
http://ExcelAndAccess.Com

919-671-9870
5109 Deer Lake Trail
Wake Forest, NC 27587
jpjones23@centurylink.net


__._,_.___

Posted by: jpjones23@centurylink.net
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (19)

.

__,_._,___

Tidak ada komentar:

Posting Komentar