473,513 Members | 2,736 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

More earth-shattering VBA code

DFS
'Search all reports for a text box named something

Dim cMsg As String, db As Database, rs As Recordset, rpt As Report, ctl as
Control
Set db = CurrentDb()
cMsg = "BuildingID"

Set rs = db.OpenRecordset("SELECT [NAME] AS REPORTOBJ FROM MSYSOBJECTS
WHERE [TYPE] = -32764;")
Do Until rs.EOF
DoCmd.openReport rs("REPORTOBJ"), acViewDesign, , , acHidden
Set rpt = Reports(rs("REPORTOBJ"))
For Each ctl In rpt.Controls
If ctl.ControlType = acTextBox Then
If ctl.Name = cMsg Then
Debug.Print "Report: " & rpt.Name & " contains " & cMsg
Exit For
End If
End If
Next ctl
Set rpt = Nothing
DoCmd.Close acReport, rs("REPORTOBJ"), acSaveNo
rs.MoveNext
Loop

rs.Close
Set rs = Nothing
MsgBox "Finished checking reports for " & cMsg

Dec 12 '06 #1
4 1841
Are you just sharing with us, or do you have a question? Generally, people
don't just post VBA code without some explanation.

Larry Linson

"DFS" <nospam@dfs_.comwrote in message
news:yS*****************@bignews3.bellsouth.net...
'Search all reports for a text box named something

Dim cMsg As String, db As Database, rs As Recordset, rpt As Report, ctl as
Control
Set db = CurrentDb()
cMsg = "BuildingID"

Set rs = db.OpenRecordset("SELECT [NAME] AS REPORTOBJ FROM MSYSOBJECTS
WHERE [TYPE] = -32764;")
Do Until rs.EOF
DoCmd.openReport rs("REPORTOBJ"), acViewDesign, , , acHidden
Set rpt = Reports(rs("REPORTOBJ"))
For Each ctl In rpt.Controls
If ctl.ControlType = acTextBox Then
If ctl.Name = cMsg Then
Debug.Print "Report: " & rpt.Name & " contains " & cMsg
Exit For
End If
End If
Next ctl
Set rpt = Nothing
DoCmd.Close acReport, rs("REPORTOBJ"), acSaveNo
rs.MoveNext
Loop

rs.Close
Set rs = Nothing
MsgBox "Finished checking reports for " & cMsg

Dec 12 '06 #2
DFS
Just sharing a handy snippet.
Larry Linson wrote:
Are you just sharing with us, or do you have a question? Generally,
people don't just post VBA code without some explanation.

Larry Linson

"DFS" <nospam@dfs_.comwrote in message
news:yS*****************@bignews3.bellsouth.net...
>'Search all reports for a text box named something

Dim cMsg As String, db As Database, rs As Recordset, rpt As Report,
ctl as Control
Set db = CurrentDb()
cMsg = "BuildingID"

Set rs = db.OpenRecordset("SELECT [NAME] AS REPORTOBJ FROM
MSYSOBJECTS WHERE [TYPE] = -32764;")
Do Until rs.EOF
DoCmd.openReport rs("REPORTOBJ"), acViewDesign, , , acHidden
Set rpt = Reports(rs("REPORTOBJ"))
For Each ctl In rpt.Controls
If ctl.ControlType = acTextBox Then
If ctl.Name = cMsg Then
Debug.Print "Report: " & rpt.Name & " contains " & cMsg
Exit For
End If
End If
Next ctl
Set rpt = Nothing
DoCmd.Close acReport, rs("REPORTOBJ"), acSaveNo
rs.MoveNext
Loop

rs.Close
Set rs = Nothing
MsgBox "Finished checking reports for " & cMsg

Dec 12 '06 #3
Thanks for the effort, it is appreciated.

Perhaps a more relevant title that would be more easily found by a google
groups search?
"DFS" <nospam@dfs_.comwrote in message news:IIHfh.71$Iz.38@bigfe9...
Just sharing a handy snippet.
Larry Linson wrote:
>Are you just sharing with us, or do you have a question? Generally,
people don't just post VBA code without some explanation.

Larry Linson

"DFS" <nospam@dfs_.comwrote in message
news:yS*****************@bignews3.bellsouth.net.. .
>>'Search all reports for a text box named something

Dim cMsg As String, db As Database, rs As Recordset, rpt As Report,
ctl as Control
Set db = CurrentDb()
cMsg = "BuildingID"

Set rs = db.OpenRecordset("SELECT [NAME] AS REPORTOBJ FROM
MSYSOBJECTS WHERE [TYPE] = -32764;")
Do Until rs.EOF
DoCmd.openReport rs("REPORTOBJ"), acViewDesign, , , acHidden
Set rpt = Reports(rs("REPORTOBJ"))
For Each ctl In rpt.Controls
If ctl.ControlType = acTextBox Then
If ctl.Name = cMsg Then
Debug.Print "Report: " & rpt.Name & " contains " & cMsg
Exit For
End If
End If
Next ctl
Set rpt = Nothing
DoCmd.Close acReport, rs("REPORTOBJ"), acSaveNo
rs.MoveNext
Loop

rs.Close
Set rs = Nothing
MsgBox "Finished checking reports for " & cMsg



Dec 13 '06 #4
DFS
Here ya go...
David F Cox wrote:
Thanks for the effort, it is appreciated.

Perhaps a more relevant title that would be more easily found by a
google groups search?
"DFS" <nospam@dfs_.comwrote in message news:IIHfh.71$Iz.38@bigfe9...
>Just sharing a handy snippet.
Larry Linson wrote:
>>Are you just sharing with us, or do you have a question? Generally,
people don't just post VBA code without some explanation.

Larry Linson

"DFS" <nospam@dfs_.comwrote in message
news:yS*****************@bignews3.bellsouth.net. ..
'Search all reports for a text box named something

Dim cMsg As String, db As Database, rs As Recordset, rpt As Report,
ctl as Control
Set db = CurrentDb()
cMsg = "BuildingID"

Set rs = db.OpenRecordset("SELECT [NAME] AS REPORTOBJ FROM
MSYSOBJECTS WHERE [TYPE] = -32764;")
Do Until rs.EOF
DoCmd.openReport rs("REPORTOBJ"), acViewDesign, , , acHidden
Set rpt = Reports(rs("REPORTOBJ"))
For Each ctl In rpt.Controls
If ctl.ControlType = acTextBox Then
If ctl.Name = cMsg Then
Debug.Print "Report: " & rpt.Name & " contains " & cMsg
Exit For
End If
End If
Next ctl
Set rpt = Nothing
DoCmd.Close acReport, rs("REPORTOBJ"), acSaveNo
rs.MoveNext
Loop

rs.Close
Set rs = Nothing
MsgBox "Finished checking reports for " & cMsg

Dec 13 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

303
17421
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
65
4006
by: Pmb | last post by:
I'm confused as to what the compiler error message I'm getting is refering to. Can someone take a gander and let me know what I did wrong? The program is below. When I compile it I get the...
21
1730
by: Gerry Abbott | last post by:
Hi All, If completed a script which parses a string into fragments (fields), then assigns these substrings into an array. I wish to turn this into a function to which i can pass the string....
4
2309
by: Ivo | last post by:
Hello all, while I am no astronomer or mathematician, I was wondering if anyone could shed some light on the following question. The phases of the moon have intrigued mankind since the dawn of...
2
1741
by: Bell, Kevin | last post by:
Sorry if this is an off topic shot in the dark, but... Does anyone know a contact for anyone that works for Google Earth? I wanted to shoot 'em an email about a possible enhancement, but they're...
4
1619
by: John Morgan | last post by:
I have been looking at the Microsoft Virtual Earth SDK. As far as I can see I have to incorporate it in a web page using a control based on Javascript through web services It being a Microsoft...
1
3439
by: John Walsh | last post by:
Hi, I'd like to write a python script to control Google Earth, and I've read that Google Earth provides a COM api, and that Python has a COM module 'pythoncom'. Anyone know where to get...
1
2568
by: =?Utf-8?B?Tmlrb2xheSBQb2Rrb2x6aW4=?= | last post by:
Good noon, community! Please help me solve my problem. I need use Microsoft(r) Virtual Earth in the my application. How can i do it? Thanks in advance!
0
352
by: service2online | last post by:
See your home on your computer through google earth SURPRIZE ! Enjoy amazing time see your earth completely Even your house Now see on your computer By controlling your self...
0
872
by: JWcode | last post by:
Hello, I am trying to do paging and Virtual Earth on the same page. I want to have the ten results on each page mapped with Virtual Earth. I can't figure out how to go through the results a...
0
7254
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7153
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...
0
7432
jinu1996
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...
1
7094
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...
0
7519
tracyyun
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...
0
5677
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5079
isladogs
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...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.