Dear All,
I want to seach the code of all forms for a string.
My code below only works for open forms.
I want it to work for all forms.
See *** Problem line ****
Thanks,
Filip
************************************************** *********************
Public Function SearchProjectFormsCode(ByVal strFindString As String) As
String
On Error GoTo errHandling
Dim MyForm As Object
Dim iObjectCount As Long
SearchProjectFormsCode = "String '" & strFindString & "' found in formcode:"
& Chr(13)
For Each MyForm In CurrentProject.AllForms
If FindInFormCode(MyForm.Name, strFindString) Then
SearchProjectFormsCode = SearchProjectFormsCode & Chr(13) & ">" &
MyForm.Name
iObjectCount = iObjectCount + 1
Next MyForm
SearchProjectFormsCode = SearchProjectFormsCode & Chr(13) & Chr(13) &
iObjectCount & " forms cheked!"
Exit Function
errHandling:
MsgBox Err.Number & " SearchProjectFormsCode: " & Err.Description &
Chr(13) & iObjectCount
End Function
Function FindInFormCode(strFormName As String, strSearchText As String) As
Boolean
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
Set mdl = Forms(strFormName).Module ' *** Problem line ****
If mdl.Find(strSearchText, lngSLine, lngSCol, lngELine, lngECol) Then
FindInFormCode = True
Else
FindInFormCode = False
End If
Exit_FindAndReplace:
Exit Function
Error_FindAndReplace:
MsgBox Err & " FindInFormCode: " & Err.Description
FindInFormCode = False
Resume Exit_FindAndReplace
End Function 4 1384
"Filips Benoit" <be***********@pandora.be> wrote in message
news:BU***********************@phobos.telenet-ops.be... Dear All,
I want to seach the code of all forms for a string. My code below only works for open forms. I want it to work for all forms.
See *** Problem line ****
Thanks,
Filip
************************************************** ********************* Public Function SearchProjectFormsCode(ByVal strFindString As String) As String
On Error GoTo errHandling
Dim MyForm As Object Dim iObjectCount As Long
SearchProjectFormsCode = "String '" & strFindString & "' found in
formcode:" & Chr(13)
For Each MyForm In CurrentProject.AllForms If FindInFormCode(MyForm.Name, strFindString) Then SearchProjectFormsCode = SearchProjectFormsCode & Chr(13) & ">" & MyForm.Name iObjectCount = iObjectCount + 1 Next MyForm SearchProjectFormsCode = SearchProjectFormsCode & Chr(13) & Chr(13) & iObjectCount & " forms cheked!"
Exit Function
errHandling: MsgBox Err.Number & " SearchProjectFormsCode: " & Err.Description & Chr(13) & iObjectCount End Function
Function FindInFormCode(strFormName As String, strSearchText As String) As Boolean 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
Set mdl = Forms(strFormName).Module ' *** Problem line ****
If mdl.Find(strSearchText, lngSLine, lngSCol, lngELine, lngECol) Then FindInFormCode = True Else FindInFormCode = False End If
Exit_FindAndReplace: Exit Function
Error_FindAndReplace:
MsgBox Err & " FindInFormCode: " & Err.Description FindInFormCode = False Resume Exit_FindAndReplace End Function
Can't be done. You will need to open the form in design mode first, and
then close it afterwards.
DoCmd.OpenForm strFormName, View:=acDesign
Works OK, Thanks Brian
"Brian" <bc**@IHATESPAMclara.co.uk> wrote in message
news:10****************@dyke.uk.clara.net... "Filips Benoit" <be***********@pandora.be> wrote in message news:BU***********************@phobos.telenet-ops.be... Dear All,
I want to seach the code of all forms for a string. My code below only works for open forms. I want it to work for all forms.
See *** Problem line ****
Thanks,
Filip
************************************************** ********************* Public Function SearchProjectFormsCode(ByVal strFindString As String) As String
On Error GoTo errHandling
Dim MyForm As Object Dim iObjectCount As Long
SearchProjectFormsCode = "String '" & strFindString & "' found in formcode:" & Chr(13)
For Each MyForm In CurrentProject.AllForms If FindInFormCode(MyForm.Name, strFindString) Then SearchProjectFormsCode = SearchProjectFormsCode & Chr(13) & ">" & MyForm.Name iObjectCount = iObjectCount + 1 Next MyForm SearchProjectFormsCode = SearchProjectFormsCode & Chr(13) & Chr(13) & iObjectCount & " forms cheked!"
Exit Function
errHandling: MsgBox Err.Number & " SearchProjectFormsCode: " & Err.Description & Chr(13) & iObjectCount End Function
Function FindInFormCode(strFormName As String, strSearchText As String)
As Boolean 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
Set mdl = Forms(strFormName).Module ' *** Problem line ****
If mdl.Find(strSearchText, lngSLine, lngSCol, lngELine, lngECol)
Then FindInFormCode = True Else FindInFormCode = False End If
Exit_FindAndReplace: Exit Function
Error_FindAndReplace:
MsgBox Err & " FindInFormCode: " & Err.Description FindInFormCode = False Resume Exit_FindAndReplace End Function
Can't be done. You will need to open the form in design mode first, and then close it afterwards.
DoCmd.OpenForm strFormName, View:=acDesign
To access any module when you know its name, ...
print vbe.ActiveVBProject.VBComponents("<modulename").Co deModule
Since form module names are of the format Form_<formname>, it's easy to
generate the name of the module, and find it in the VBComponents collection.
Since not all forms must have modules, you might have to trap for the error
that occurs if the module doesn't exist.
On Sun, 10 Oct 2004 07:54:09 GMT, "Filips Benoit" <be***********@pandora.be>
wrote: Dear All,
I want to seach the code of all forms for a string. My code below only works for open forms. I want it to work for all forms.
See *** Problem line ****
Thanks,
Filip
************************************************* ********************** Public Function SearchProjectFormsCode(ByVal strFindString As String) As String
On Error GoTo errHandling
Dim MyForm As Object Dim iObjectCount As Long
SearchProjectFormsCode = "String '" & strFindString & "' found in formcode:" & Chr(13)
For Each MyForm In CurrentProject.AllForms If FindInFormCode(MyForm.Name, strFindString) Then SearchProjectFormsCode = SearchProjectFormsCode & Chr(13) & ">" & MyForm.Name iObjectCount = iObjectCount + 1 Next MyForm SearchProjectFormsCode = SearchProjectFormsCode & Chr(13) & Chr(13) & iObjectCount & " forms cheked!"
Exit Function
errHandling: MsgBox Err.Number & " SearchProjectFormsCode: " & Err.Description & Chr(13) & iObjectCount End Function
Function FindInFormCode(strFormName As String, strSearchText As String) As Boolean 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
Set mdl = Forms(strFormName).Module ' *** Problem line ****
If mdl.Find(strSearchText, lngSLine, lngSCol, lngELine, lngECol) Then FindInFormCode = True Else FindInFormCode = False End If
Exit_FindAndReplace: Exit Function
Error_FindAndReplace:
MsgBox Err & " FindInFormCode: " & Err.Description FindInFormCode = False Resume Exit_FindAndReplace End Function
Good answer, better suggestion than mine.
"Steve Jorgensen" <no****@nospam.nospam> wrote in message
news:31********************************@4ax.com... To access any module when you know its name, ...
print vbe.ActiveVBProject.VBComponents("<modulename").Co deModule
Since form module names are of the format Form_<formname>, it's easy to generate the name of the module, and find it in the VBComponents
collection. Since not all forms must have modules, you might have to trap for the
error that occurs if the module doesn't exist.
On Sun, 10 Oct 2004 07:54:09 GMT, "Filips Benoit"
<be***********@pandora.be> wrote:
Dear All,
I want to seach the code of all forms for a string. My code below only works for open forms. I want it to work for all forms.
See *** Problem line ****
Thanks,
Filip
************************************************* ********************** Public Function SearchProjectFormsCode(ByVal strFindString As String) As String
On Error GoTo errHandling
Dim MyForm As Object Dim iObjectCount As Long
SearchProjectFormsCode = "String '" & strFindString & "' found in
formcode:"& Chr(13)
For Each MyForm In CurrentProject.AllForms If FindInFormCode(MyForm.Name, strFindString) Then SearchProjectFormsCode = SearchProjectFormsCode & Chr(13) & ">" & MyForm.Name iObjectCount = iObjectCount + 1 Next MyForm SearchProjectFormsCode = SearchProjectFormsCode & Chr(13) & Chr(13) & iObjectCount & " forms cheked!"
Exit Function
errHandling: MsgBox Err.Number & " SearchProjectFormsCode: " & Err.Description & Chr(13) & iObjectCount End Function
Function FindInFormCode(strFormName As String, strSearchText As String)
AsBoolean 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
Set mdl = Forms(strFormName).Module ' *** Problem line ****
If mdl.Find(strSearchText, lngSLine, lngSCol, lngELine, lngECol) Then FindInFormCode = True Else FindInFormCode = False End If
Exit_FindAndReplace: Exit Function
Error_FindAndReplace:
MsgBox Err & " FindInFormCode: " & Err.Description FindInFormCode = False Resume Exit_FindAndReplace End Function This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Zeeshan |
last post by:
In What are the possible ways to get hogh ranking in seach engine ?
I know sone way as follows:
1. Executing .html extension as php file through .htaccess file
2. XML object of javascript etc
|
by: Iain Miller |
last post by:
Now this shouldn't be hard but I've been struggling on the best way as to
how to do this one for a day or 3 so I thought I'd ask the assembled
company.....
I'm writing an application that tracks...
|
by: rh |
last post by:
Hi, I'd like to add an incremental search to my windows form DataGrid that
works like the one used in Windows Explorer.
In Windows Explorer, when you type a character it jumps to the first item...
|
by: Miguel Dias Moura |
last post by:
Hello,
i am creating an ASP.net / VB web site with Dreamweaver MX 2004.
I have a form and a "Insert Record Behavior" to insert the form values in
the database.
Dreamweaver puts this code in...
|
by: Steve |
last post by:
Hi-
I'm looking to make an asp.net application that will allow site visitors to
enter their zip and find the closest dealer in our database. Funny thing
is... I have NO idea how this is done! I...
|
by: mmarif4u |
last post by:
Hi Everyone.
I have html page coding:
HTML coding.....
---------------------------------------------------
<h2>Search</h2>
<form name="search" method="post" action="Search.php">
Seach for:...
|
by: vve |
last post by:
I'm discovering a strange behaviour in an C# project using ZedGraph
(https://sourceforge.net/projects/zedgraph/).
After adding a signal to it, it seems that the clr goes mad for some
reason. I...
|
by: prpradip |
last post by:
In my application ListView is inside panel (XP theme enable), item text in the ListView control overlaps other items in small icon view. The items are drawn as if aligned to a grid and this causes...
|
by: desertavataraz |
last post by:
This is Visual Basic 2008:
I have an application where I have the main textbox on the main form, and the search window on a seperate form, and whenever someone clicks the mouse in the main forms...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |