Access 2K7 - Showing TIF files in a form via VBA code

I followed the directions here:
http://support.microsoft.com/default.aspx?scid=kb;en-us;285820

When I run it, I'm getting the error:
"438 Object doesn't support this property or method"

It looks like it's breaking on this bit of code:
".Picture = strImagePath"

Any idea what I'm doing wrong?

Module code:
Option Compare Database
Option Explicit

Public Function DisplayImage(ctlImageControl As Control, strImagePath As 
Variant) As String
On Error GoTo Err_DisplayImage

Dim strResult As String
Dim strDatabasePath As String
Dim intSlashLocation As Integer

With ctlImageControl
    If IsNull(strImagePath) Then
        .Visible = False
        strResult = "No image name specified."
    Else
        If InStr(1, strImagePath, "\") = 0 Then
            ' Path is relative
            strDatabasePath = CurrentProject.FullName
            intSlashLocation = InStrRev(strDatabasePath, "\", 
Len(strDatabasePath))
            strDatabasePath = Left(strDatabasePath, intSlashLocation)
            strImagePath = strDatabasePath & strImagePath
        End If
        .Visible = True
        .Picture = strImagePath
        strResult = "Image found and displayed."
    End If
End With
    
Exit_DisplayImage:
    DisplayImage = strResult
    Exit Function

Err_DisplayImage:
    Select Case Err.Number
        Case 2220       ' Can't find the picture.
            ctlImageControl.Visible = False
            strResult = "Can't find image in the specified name."
            Resume Exit_DisplayImage:
        Case Else       ' Some other error.
            MsgBox Err.Number & " " & Err.Description
            strResult = "An error occurred displaying image."
            Resume Exit_DisplayImage:
    End Select
End Function

Form code:
Option Compare Database
Option Explicit

Private Sub Form_AfterUpdate()
    CallDisplayImage
End Sub

Private Sub Form_Current()
    CallDisplayImage
End Sub

Private Sub txtImageName_AfterUpdate()
    CallDisplayImage
End Sub

Private Sub CallDisplayImage()
    Me!txtImageNote = DisplayImage(Me!txtImageID, Me!txtImagePath)
End Sub

0
Utf
3/11/2010 2:40:07 PM
access.formscoding 7493 articles. 0 followers. Follow

1 Replies
1869 Views

Similar Articles

[PageSpeed] 54

try a different format like .bmp or .jpg if those work then my guess would be 
that the .tiff isn't a supported imagefile.
-- 
Maurice Ausum


"rc51wv" wrote:

> I followed the directions here:
> http://support.microsoft.com/default.aspx?scid=kb;en-us;285820
> 
> When I run it, I'm getting the error:
> "438 Object doesn't support this property or method"
> 
> It looks like it's breaking on this bit of code:
> ".Picture = strImagePath"
> 
> Any idea what I'm doing wrong?
> 
> Module code:
> Option Compare Database
> Option Explicit
> 
> Public Function DisplayImage(ctlImageControl As Control, strImagePath As 
> Variant) As String
> On Error GoTo Err_DisplayImage
> 
> Dim strResult As String
> Dim strDatabasePath As String
> Dim intSlashLocation As Integer
> 
> With ctlImageControl
>     If IsNull(strImagePath) Then
>         .Visible = False
>         strResult = "No image name specified."
>     Else
>         If InStr(1, strImagePath, "\") = 0 Then
>             ' Path is relative
>             strDatabasePath = CurrentProject.FullName
>             intSlashLocation = InStrRev(strDatabasePath, "\", 
> Len(strDatabasePath))
>             strDatabasePath = Left(strDatabasePath, intSlashLocation)
>             strImagePath = strDatabasePath & strImagePath
>         End If
>         .Visible = True
>         .Picture = strImagePath
>         strResult = "Image found and displayed."
>     End If
> End With
>     
> Exit_DisplayImage:
>     DisplayImage = strResult
>     Exit Function
> 
> Err_DisplayImage:
>     Select Case Err.Number
>         Case 2220       ' Can't find the picture.
>             ctlImageControl.Visible = False
>             strResult = "Can't find image in the specified name."
>             Resume Exit_DisplayImage:
>         Case Else       ' Some other error.
>             MsgBox Err.Number & " " & Err.Description
>             strResult = "An error occurred displaying image."
>             Resume Exit_DisplayImage:
>     End Select
> End Function
> 
> Form code:
> Option Compare Database
> Option Explicit
> 
> Private Sub Form_AfterUpdate()
>     CallDisplayImage
> End Sub
> 
> Private Sub Form_Current()
>     CallDisplayImage
> End Sub
> 
> Private Sub txtImageName_AfterUpdate()
>     CallDisplayImage
> End Sub
> 
> Private Sub CallDisplayImage()
>     Me!txtImageNote = DisplayImage(Me!txtImageID, Me!txtImagePath)
> End Sub
> 
0
Utf
3/11/2010 2:56:01 PM
Reply:

Similar Artilces:

Using Relative path for XML data file?
Is there a way to specify a relative path to an XML data file imported into Excel 2003? I am writing a web app that generates report data as XML for the user to download to their local machine. This data is to be consumed by an Excel reporting spreadsheet, which contains display-formatted tables and charts that are mapped to various data fields in an XML Map, which is in turn linked to the xml data file they will download. The idea is the user only needs to download the data for updates, not the whole spreadsheet. However, since I cannot predict the path where the user will store their...

How to repair a .dll file in IE8
Several days ago I noticed in my Dependency Walker that the IESHIMS.dll files has a yellow circle with a question mark on it. What does this mean and How do I repair it? OS: Windows Vista Home Premium Browser Internet Explorer 8 -- TW Hi, See the History tab on that dialog. A web search for ieshims.dll files will also help you find a solution for that file. Regards. "TW" <TW@discussions.microsoft.com> wrote in message news:63E61463-D766-4ABC-B081-BFA8C04FB159@microsoft.com... > Several days ago I noticed in my Dependency Walker that the IESHIMS....

unsolicited entry in the folder "Temporary Internet Files"
Hello, I am working on a programme which browses web sites and runs under XP. The http download is as follows: pServer = Isession -> GetHttpConnection(strServerName, nPort); pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_GET, strObject, NULL, 1, NULL, NULL, dwHttpRequestFlags); pFile->SendRequest(); pFile->QueryInfoStatusCode(dwStatusCode); if(dwStatusCode == 200) { pFile -> QueryInfo(HTTP_QUERY_LAST_MODIFIED, &sysT); status.lastMod = sysT; if(DBlastMod == status.lastMod) //URL content has not changed since the last visit ...

Linking files 2 ways
I have a work book that is linked to another and vise versa. As thus: Workbook A is where the input of data is made; Workbook B has a link to the input from workbook A; Workbook A retrieves the altered data back as a link. Although this all works fine with both books open, I note that if I open workbook A by itself, that the data it retrieves from Workbook B is not updated . If However, both books are open, there's no problem. I thought linked books were updated automatically if the Update remote references has been selected?? But it appears that the second book is not updated until it ...

OL2007 not move big files from outbox to sent
Hi, We have 2 computers with separate email accounts on Roadrunner. One machine has XP with Outlook 2002-sp3 and works without any problems. The other has Outlook 2007 on Vista and has problems sending files over a meg or so in size. It seems to actually send the file but the file remains in the outbox folder and does not move it to the sent folder. I say it "seems" to send the file because some people complain of getting muliple copies and others don't seem to get them at all. If I hit send again (not set up for auto send) it seems to send the file again (why some ...

File size #11
I have read the other discussions on file sizes but they do not seem to address my problem. I have an Excel file that is 12mb large with low-res jpegs in it. This file also has merged cells to make it look pretty. Does Excel look at these merged cells as graphics? Is this why they are too big? I have run a macro to make sure that it goes to the last cell. How can I get the file smaller? How big are the graphics? If you remove them from the file, what is the size of the file and what is the size of the graphic files? To be sure you do not have extra formatting, if you open the file...

find action on log file
Hello there I want to use outside tool to find who made some update on table in my server I know that there are many tools for this. But can they do it on simple recovery model? Roy Goldhammer (royg@yahoo.com) writes: > I want to use outside tool to find who made some update on table in my > server > > I know that there are many tools for this. But can they do it on simple > recovery model? No. If you are using the simple recovery model, the contents of the log is wasted away everyonce in a while. Well, if the disk area has not been overwritten...

Reporting from Project Server
I dont know if i need to ask this question here or in the Access section. I have an ODBC connection to the Project Server database so I can make reports through Access. Access' limit of 255 fields per table is causing me some trouble. for example, the MSP_VIEW_PROJ_PROJECTS_ENT table has well over 255 fields. Access only shows me the first 255 fields. how can I change that so I can see all the fields in that table? thanks, Hadi Hadi, I have not tried this yet it may be a viable option. Have your DBA create a view that pulls the key fields to this table and the specifi...

Maximum file sizes
Is there a recommended maximum file size for Excel 2000. PC spec 2Ghz P4 with 256 Mb Any advice appreciated Deus -------------- Does Not Exist Hi have a look at http://www.decisionmodels.com/memlimits.htm -- Regards Frank Kabel Frankfurt, Germany "Deus DNE" <deus.dne@ntlworld.com> schrieb im Newsbeitrag news:1561701c41d4f$358950f0$a001280a@phx.gbl... > Is there a recommended maximum file size for Excel 2000. > > PC spec 2Ghz P4 with 256 Mb > > Any advice appreciated > > Deus > -------------- > Does Not Exist ...

"View Image Slide Show"
(Running Vista Ultimate 64-bit, SP-2, IE-8, WM-6, WLM-09, classic mode, dial-up.) In Windows Live Mail, most of the time when I receive an email with 2 or more .jpg files attached, there is an option shown as: "View Image Slide Show". Clicking on that line brings up a screen which allows me to cycle through the attached .jpg files, viewing them in sequence, going back and forth as I desire. About every 10 or so emails having some .jpg files as attachments I receive one, with several such attachments, which does NOT have the "View Image Slide Show" op...

Savings a/c cashflow doesn't show withdrawals
Money 2003 When I do a cashflow forecast for my savings a/c it doesn't take into account transfers to my "cash" account - the one I use to keep track of what I spend my cash on. Consequently when I do the cashflow it gives an unreal projection of savings. I wish I could save $3000 in 2 months but it's not going to happen... ...

CSV Files and VLOOKUP error
Does anyone know why VLOOKUP and Compare formulas don't work o information originating from a CSV file? I've tried copying an pasting values only (to leave behind any formatting), but it doesn' help. Through countless tests, I've narrowed it down to the CSV file bein the only possible cause -- Message posted from http://www.ExcelForum.com Hi ajpowers, Just a guess but the imported data may have leading or trailing spaces or are numbers stored as text. You could use the formula =A1=D1 to see if you get a true or false, where A1 is the lookup value and D1 ia the CVS valu...

explanation of codes in Visual Basic when creating User form
Hi, I am trying to create a user form in Visual Basic however I'm trying to teach myself by reading/watching tutorials. (www.contectures.o.ca, etc) A lot of the instructions I am seeing simply give the code rather than explain how to actually write one from scratch. So... I need to know what each 'term' means so I can understand how the codes work. Any help is much appreciated :) One of the first codes is for the Add button Private Sub cmdAdd_Click() Dim iRow As Long Dim ws As Worksheet Set ws = Worksheets("PartsData") What d...

How to automate increasing the form cache registry/file etc...
I want to roll out a batch file to make a number of tweaks to CRM The body of it would go REGEDIT /S Kerberosefix.reg REGEDIT /S ForceFormreload.reg REGEDIT /S OutlookFix.reg It would also rename OSA.exe to OSA.bad Remove OSA.exe From the startup menu I need help finding a way to use my batch file to increase the Outlook Form cache from the default 4MB to 50 MB.. This makes CRm more stable and faster for communications. I dont want to manually do this, as it time consuming, are my end users would not be reliable in doing it themselves. I also want to make another batch file or button that...

Show date, time & day of week in one cell
Can I show the date, time and day of week in one cell. I have: 09/03/07 8:30 AM in one cell using the format (Format/Cells/Custom): [$-409]mm/dd/yy h:mm AM/PM;@ Excel refuses to accept ddd for Mon or dddd Monday at the end of the format I want it to read: 09/03/07 8:30 AM Monday in 1 cell. I have Excel 2003. One way: mm/dd/yy h:mm AM/PM dddd;@ In article <Xns99B8A3CAF9130pencilunlistedcom@208.49.82.220>, Burp <burp@beep.comINVALID> wrote: > Can I show the date, time and day of week in one cell. > > I have: > 09/03/07 8:30 AM > in one cell using the for...

How to set "licence" for Access 2007 database?
Hi I developed an Access 2007 db to a client. Now I want to make a year based licence for that database that the client must pay if they want to continue using the database after year. It must be so that database cannot be used after this date. How I can accomplish this? Thanks! On Mon, 12 Apr 2010 13:14:17 -0700 (PDT), Sandroid <santeri.virtanen@gmail.com> wrote: >Hi > >I developed an Access 2007 db to a client. Now I want to make a year >based licence for that database that the client must pay if they want >to continue using the database after year. It mu...

formula or VBA
I need to search through a column checking condtions. If the conditions are met, then I want to enter the corresponding value in the column next to it into a different cell. Basically, I want to search column A and, if the conditions are met, put the value in B into C. Would this be easier via formula or code? And maybe some starting suggestions would be nice if you don't mind. -- Thanks, Jim in a formula in col b =if(cond,a1,"") using vba for each c in range("a1:a100") if cond then c.offset(0,1)=c next -- Don Guillett SalesAid Software donaldb@281.com "...

microsoft.public.access.conversion
...

form fields not saving to table
I have created a database with a form and three of the fields are not saving the information to the table. I have checked the row and control sources and now at a loss and thoughts? As you scroll through existing records is the data of the table displayed? Post the SQL of the query or form source. -- Build a little, test a little. "Kim" wrote: > I have created a database with a form and three of the fields are not saving > the information to the table. I have checked the row and control sources and > now at a loss and thoughts? > > ...

Excel VBA
When you select the autofilter, the drop down list is created from the unique data in that column. Is there any way to customize this list, so the changes are permanent? For instance, I might have in one(1) column the following 4 row entries: red, blue, green (all are single cell entries) red, blue red blue, green I want my autofilter drop down list to read: red instead of red, blue, green blue red, blue green red blue, green (like normal) If I chose red from the drop down list...

Access to User Calendar
I have a user called small conference room that is used to schedule meetings on its calendar. I would like to link the calendar from our intranet site to the calendar with a UNC path. I am calling outlook: and I can get to my local mailbox and public folders but I am unable to connect to another users calendar. I am running Exchange 2003 and Outlook 2003. Is there some security modifications that need to be done? Any help is appreciated. Thanks, Steve I believe that you will need full mailbox rights. -- Ed Crowley MVP - Exchange "Protecting the world from PSTs and brick backups!&...

Query by Form-TJ
I need to do a Query by Form based on multiple selections from combo boxes on a form using Access 2000 I need to bring back the appropriate records in a subform. On Mon, 31 May 2010 07:08:01 -0700, ambushsinger <ambushsinger@discussions.microsoft.com> wrote: Query by Form can't do that. It can only select records in the current form view. After that, you can potentially open a new form with that subset of records in a subform. -Tom. Microsoft Access MVP >I need to do a Query by Form based on multiple selections from combo boxes on >a form using Access 200...

Mobile Access
When I try to reach our mobile access by typing http://serverIP/oma, I get the error... A system error has occurred while processing your request. Please try again. If the problem persists, contact your administrator. Any ideas what could be wrong? Thanks, Jose What is "oma" supposed to be? "Jose Alfaro" <ja@mkrs.com> wrote in message news:2cfc01c3fcaa$2e5247d0$a101280a@phx.gbl... > When I try to reach our mobile access by typing > http://serverIP/oma, I get the error... > > A system error has occurred while processing your > request. Please...

form base authentication #2
This is killing me. I'm implementing form base authentication. I have SSL and everything working but for one problem when use won't to get to owa they type mail.domain.com which then defaults to http://mail.domain.com. the problem I'm having is that FBA need it to default to https not http. How can I get it to default to HTTPS with out telling the uses to type https? I am implementing this on a FE/BE environment wayne .. What I do is change the http port on the main site to something like 8080, and then create a new site that listens on 80. For that site, instead of...

Effective VBA Code for Conditional Charting
Hello there, in a line chart, I need to show 3 different markers / colors for data points depending on whether the basic data to be shown are =, > or < zero. My attempts to code this in vba works, but very slowly. I suspect there is an effective way to do this, but can't find it. Does anyboday know better ? Thank you in advance, Kind regards, H.G. Lamy Hi H, Maybe you don't need VBA code at all. Have a look at Jon Peltier's examples on conditional charts. (http://www.geocities.com/jonpeltier/Excel/Charts/format.html#CondChart) You should be able to modify the techn...