Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search forms/reports for image

Status
Not open for further replies.

VicM

Programmer
Sep 24, 2001
444
US
Hi,

Working on a DB which has grown over the years. In the beginning the original programmer embedded a logo on many of the switchboard type forms as well as reports. Because of the growth of the DB, there are literally hundreds of forms & reports containing the logo.

When a logo is updated, must go thru every form & report to change same. Want to change the logo from embedded to linked, where a change in the logo will be reflected wherever it's used.

Is there a way to search thru the forms & reports collections for the existence of the logo without having to open each one in design mode?

Thanks,

Vic
 
VicM,
To directly answer your question, no. But you can make a routine open the opjects in design mode, then search them for you. This will do forms, but it can easily be ported over to reports.
Since I don't know how you want to report the finding I just wrote the details of each item found to the Immediate window.
Code:
Sub FindImages()
Dim aoCurrent As AccessObject
Dim frmCurrent As Form
Dim ctlCurrent As Control
For Each aoCurrent In CurrentProject.AllForms
  DoCmd.OpenForm aoCurrent.Name, acDesign
  Set frmCurrent = Forms(aoCurrent.Name)
  For Each ctlCurrent In frmCurrent.Controls
    If ctlCurrent.ControlType = acImage Then
      Debug.Print frmCurrent.Name, ctlCurrent.Name, ctlCurrent.Picture, ctlCurrent.PictureType
    End If
  Next ctlCurrent
  DoCmd.Close acForm, aoCurrent.Name, acSaveNo
  Set frmCurrent = Nothing
Next aoCurrent
Set aoCurrent = Nothing
End Sub
With a little tweaking you could make this routine change all the images to linked and point to the new logo file.

Hope this helps,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
CMP,

Thanks for your input. I suspected there wasn't a quick way, but your code will be very helpful. I appreciate it.

Vic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top