Problem with error 53

I've got a small loop that looks for data in 1 of 4 places.  If it doesn't
find a valid path it should create an error 53 which should then be
processed.

In most cases, the path to the desired file will be invalid and Error 53
will occur.

The code is this:

PictureNum = 0

Check1:
    PictureNum = PictureNum + 1
    If PictureNum = 5 Then Exit Sub

    On Error GoTo Error53Check

    If PictureNum = 1 Then FilePath = ("N:\Casefiles\" & [CASENO] & "\" &
[CASENO] & "-dp0.jpg")
    If PictureNum = 2 Then FilePath = ("N:\Casefiles\" & [CASENO] & "\" &
[CASENO] & "-dp00.jpg")
    If PictureNum = 3 Then FilePath = ("N:\Casefiles\" & [CASENO] &
"-dp0.jpg")
    If PictureNum = 4 Then FilePath = ("N:\Casefiles\" & [CASENO] &
"-dp00.jpg")
    Open FilePath For Input As #10
    Close #10
         Me![Image151].Picture = FilePath
    GoTo Check1

Error53Check:
    ErrNum = err
    If err <> 53 Then GoTo MsgBoxNot53
    If PictureNum = 4 Then Exit Sub
       GoTo Check1

MsgBoxNot53:
       Call Error_Handler(ErrNum)    'MsgBox "Some other error occured.
Error Number " & err


The first time through, it works fine when it has a bad path, it errors and
loops back.  But when it loops back to 'Check1', increments PictureNum and
doesn't find the the path, instead going to Error53Check again, I get the
standard Access error box.

Hope this makes sense.

Thanks,
Doug Sanders





-1
Doug
5/14/2007 3:31:03 AM
access.formscoding 7493 articles. 0 followers. Follow

2 Replies
1054 Views

Similar Articles

[PageSpeed] 30

In news:XJQ1i.9741$Ut6.8583@newsread1.news.pas.earthlink.net,
Doug Sanders <DougSix@earthlink.net> wrote:
> I've got a small loop that looks for data in 1 of 4 places.  If it
> doesn't find a valid path it should create an error 53 which should
> then be processed.
>
> In most cases, the path to the desired file will be invalid and Error
> 53 will occur.
>
> The code is this:
>
> PictureNum = 0
>
> Check1:
>    PictureNum = PictureNum + 1
>    If PictureNum = 5 Then Exit Sub
>
>    On Error GoTo Error53Check
>
>    If PictureNum = 1 Then FilePath = ("N:\Casefiles\" & [CASENO] &
> "\" & [CASENO] & "-dp0.jpg")
>    If PictureNum = 2 Then FilePath = ("N:\Casefiles\" & [CASENO] &
> "\" & [CASENO] & "-dp00.jpg")
>    If PictureNum = 3 Then FilePath = ("N:\Casefiles\" & [CASENO] &
> "-dp0.jpg")
>    If PictureNum = 4 Then FilePath = ("N:\Casefiles\" & [CASENO] &
> "-dp00.jpg")
>    Open FilePath For Input As #10
>    Close #10
>         Me![Image151].Picture = FilePath
>    GoTo Check1
>
> Error53Check:
>    ErrNum = err
>    If err <> 53 Then GoTo MsgBoxNot53
>    If PictureNum = 4 Then Exit Sub
>       GoTo Check1
>
> MsgBoxNot53:
>       Call Error_Handler(ErrNum)    'MsgBox "Some other error occured.
> Error Number " & err
>
>
> The first time through, it works fine when it has a bad path, it
> errors and loops back.  But when it loops back to 'Check1',
> increments PictureNum and doesn't find the the path, instead going to
> Error53Check again, I get the standard Access error box.
>
> Hope this makes sense.
>
> Thanks,
> Doug Sanders

You need to use the Resume statement to exit your error-handler, not a 
Go To statement.  If you just branch out with a Go To, you are still in 
the error-handler as far as VBA is concerned, and so a new error will be 
passed upward for handling.

It's going to be hard to get that sorted out without revising your whole 
looping structure.  All this "Going To" makes for convoluted code that 
is hard to debug.  How about something like this instead:

'----- start of revised code -----

    ' ... code before this ...

    Dim astrFilePath As Variant
    Dim FilePath As String
    Dim blnGotPic As Boolean

    astrFilePath = Array( _
        "N:\Casefiles\" & [CASENO] & "\" & [CASENO] & "-dp0.jpg", _
        "N:\Casefiles\" & [CASENO] & "\" & [CASENO] & "-dp00.jpg", _
        "N:\Casefiles\" & [CASENO] & "-dp0.jpg", _
        "N:\Casefiles\" & [CASENO] & "-dp00.jpg" _
        )

    On Error GoTo Error53Check

    For PictureNum = LBound(FilePath) To UBound(FilePath)
        FilePath = astrFilePath(PictureNum)
        If Len(Dir(FilePath)) > 0 Then
            Me![Image151].Picture = FilePath
            Exit For
         End If
NextPicture:
    Next PictureNum

    ' If necessary, you could have code that checks whether
    ' you ever found a picture or not, and does something
    ' accordingly.

Exit_Point:
    Exit Sub

Error53Check:
    If Err.Number = 53 _
    Or Err.Number = 52 _
    Then
        Resume NextPicture
    Else
        ErrNum = Err.Number
        Call Error_Handler(ErrNum)
        ' or otherwise handle error
        Resume Exit_Point
    End If

End Sub
'----- end of revised code -----

Note that I replaced your code to check the file by opening it with code 
a call to the Dir() function to see if the file exists.  If you really 
need to verify that you can open the file, not just that it exists, that 
replacement will have to be undone.  With this change in place, I don't 
think you're going to get error 53, anyway, but you might get error 52 
("Bad file name or number"), so I added that to the error-handling code 
just in case.

-- 
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


-1
Dirk
5/14/2007 4:15:41 AM
Of course, 'Resume' is missing.

Thanks, and I'll review your other ideas too.

Thanks a lot.

Doug Sanders


"Dirk Goldgar" <dg@NOdataSPAMgnostics.com> wrote in message
news:uwykD6dlHHA.2272@TK2MSFTNGP02.phx.gbl...
> In news:XJQ1i.9741$Ut6.8583@newsread1.news.pas.earthlink.net,
> Doug Sanders <DougSix@earthlink.net> wrote:
> > I've got a small loop that looks for data in 1 of 4 places.  If it
> > doesn't find a valid path it should create an error 53 which should
> > then be processed.
> >
> > In most cases, the path to the desired file will be invalid and Error
> > 53 will occur.
> >
> > The code is this:
> >
> > PictureNum = 0
> >
> > Check1:
> >    PictureNum = PictureNum + 1
> >    If PictureNum = 5 Then Exit Sub
> >
> >    On Error GoTo Error53Check
> >
> >    If PictureNum = 1 Then FilePath = ("N:\Casefiles\" & [CASENO] &
> > "\" & [CASENO] & "-dp0.jpg")
> >    If PictureNum = 2 Then FilePath = ("N:\Casefiles\" & [CASENO] &
> > "\" & [CASENO] & "-dp00.jpg")
> >    If PictureNum = 3 Then FilePath = ("N:\Casefiles\" & [CASENO] &
> > "-dp0.jpg")
> >    If PictureNum = 4 Then FilePath = ("N:\Casefiles\" & [CASENO] &
> > "-dp00.jpg")
> >    Open FilePath For Input As #10
> >    Close #10
> >         Me![Image151].Picture = FilePath
> >    GoTo Check1
> >
> > Error53Check:
> >    ErrNum = err
> >    If err <> 53 Then GoTo MsgBoxNot53
> >    If PictureNum = 4 Then Exit Sub
> >       GoTo Check1
> >
> > MsgBoxNot53:
> >       Call Error_Handler(ErrNum)    'MsgBox "Some other error occured.
> > Error Number " & err
> >
> >
> > The first time through, it works fine when it has a bad path, it
> > errors and loops back.  But when it loops back to 'Check1',
> > increments PictureNum and doesn't find the the path, instead going to
> > Error53Check again, I get the standard Access error box.
> >
> > Hope this makes sense.
> >
> > Thanks,
> > Doug Sanders
>
> You need to use the Resume statement to exit your error-handler, not a
> Go To statement.  If you just branch out with a Go To, you are still in
> the error-handler as far as VBA is concerned, and so a new error will be
> passed upward for handling.
>
> It's going to be hard to get that sorted out without revising your whole
> looping structure.  All this "Going To" makes for convoluted code that
> is hard to debug.  How about something like this instead:
>
> '----- start of revised code -----
>
>     ' ... code before this ...
>
>     Dim astrFilePath As Variant
>     Dim FilePath As String
>     Dim blnGotPic As Boolean
>
>     astrFilePath = Array( _
>         "N:\Casefiles\" & [CASENO] & "\" & [CASENO] & "-dp0.jpg", _
>         "N:\Casefiles\" & [CASENO] & "\" & [CASENO] & "-dp00.jpg", _
>         "N:\Casefiles\" & [CASENO] & "-dp0.jpg", _
>         "N:\Casefiles\" & [CASENO] & "-dp00.jpg" _
>         )
>
>     On Error GoTo Error53Check
>
>     For PictureNum = LBound(FilePath) To UBound(FilePath)
>         FilePath = astrFilePath(PictureNum)
>         If Len(Dir(FilePath)) > 0 Then
>             Me![Image151].Picture = FilePath
>             Exit For
>          End If
> NextPicture:
>     Next PictureNum
>
>     ' If necessary, you could have code that checks whether
>     ' you ever found a picture or not, and does something
>     ' accordingly.
>
> Exit_Point:
>     Exit Sub
>
> Error53Check:
>     If Err.Number = 53 _
>     Or Err.Number = 52 _
>     Then
>         Resume NextPicture
>     Else
>         ErrNum = Err.Number
>         Call Error_Handler(ErrNum)
>         ' or otherwise handle error
>         Resume Exit_Point
>     End If
>
> End Sub
> '----- end of revised code -----
>
> Note that I replaced your code to check the file by opening it with code
> a call to the Dir() function to see if the file exists.  If you really
> need to verify that you can open the file, not just that it exists, that
> replacement will have to be undone.  With this change in place, I don't
> think you're going to get error 53, anyway, but you might get error 52
> ("Bad file name or number"), so I added that to the error-handling code
> just in case.
>
> -- 
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>
>


1
Doug
5/14/2007 4:28:12 AM
Reply:

Similar Artilces:

Move Mailbox errors
I'm currently migrating from Exchange 2000 to Exchange 2003. We're in a native mode Windows 2003 AD. I am migrating about 500 mailbox from a standalone Exchange 2000 to a WIndows 2003 / Exchange 2003 Active/passive cluster configuration. Mailbox moves have been going great up until yesterday. While moving the users in the normal way,2 mailboxes hung at 100%. In the "state" column, it says: "Saving changes to the directory". I let it sit at this stage for more than 10 hours. I then have to cancel the task, then it says cancel running tasks, and this wil...

outlook 2007 error message in archive folders
for no discernable reason some and only some of my archive folders will no longer open and give the following error message: the message interface has returned an unknown error. If the problem persists restart Oultlook I have restarted not only outlook but rebooted my computer with no positive result. I have also gone back a month to a restore point but this has not changed the position. As I say it is only some files and then only some subfiles in larger files. One month ago there were no issues. I have added no new programs to the computer Try running scanpst.exe against y...

Cached Exchange and GAL Problem
I have a windows domain with an Exchange organisation that houses multiple e-mail domains. Each E-mail domain belongs to a different company and has its own GAL. When the users login via terminal services and start Outlook they only see the users within their own company. This is fine, no problem here......Some of these users connect with the same username and password using Outlook 2003 RPC over HTTP that connects to exactly the smae Exchange organisation. When using cached exchange mode and the user clicks on the address book, it displays the entire organisation including information about t...

Error Number: 0x800ccc0e when I try to get messages
Hello, I am a postmaster of our network and I am having some problems with Outlook 2000 and our pop3 server. The problem is that randomly, Outlook's users can not download their mail because they get the error number 0x800ccc0e when they try to send amd receive mail. We are using Microsoft Outlook 2000 SP-3 (9.0.0.6627) and our server is a Linux Debian running a 2.4.27 kernel. I have tried with ipop3d and in.qpopper as a pop3 daemons and with both I get the error. There is no firewall between them and this is the tcpdump capture from the server (our pop3 server runs at port 40110, bu...

80040e19 error occurring with 2nd NIC installed
I am experiencing the 80040e19 error when expanding public folders in Exchange System Manager, Exchange 2000. I have exhausted all suggested MS articles and *still* have not resolved the issue. No evidence of URLScan or iislockdown being run on the server. Strange thing is is that when I disable the newly installed NIC through device manager the public folders can be expanded perfectly. On enabling the NIC, same error. The server is the PDC, Exchange and Intranet server, running IIS on port 80 for local intranet site and the admin website on port 7715. I have checked the host head...

Formula problem #9
Hi, I have entered a small formula in a cell =A1+B1 the result is also fine but if i have edit the formula i have to again type the entire thing. Is there a shortcut to this where i can easily do the editing of the formula, i guess i am missing something out here. Hi, I guess you are not able to see the formula in the formula bar if it is so then go to Tools|Options|View|check the formula bar check box|ok -- _______________________ Click "Yes" if it helps ________ Thanks Suleman Peerzade "Niroo" wrote: > Hi, > > I have entered a small formula in a cell ...

space then date causes error
On my spreadsheet they have to type in a date and other calculations are taken from this point. Of the hundreds that have used it there have been no problems, however as always there will always be one....... When they fill in the date they type a space and then type the date, this throws up errors in the other calculations. Not altogether important but is there an easy fix for this, so that if anyone types a space it is ignored, I dont want to get involved in VBA/macro stuff. Right click the sheet tab>view code>insert this>modify range to suit Private Sub Worksheet_Change(By...

Copy sheet in Excel
Hi Wonder if anyone of you encounter this problem before? When I try to copy worksheet in a workbook, the following prompt comes up, indicating name conflict. "A formula or sheet you want to move or copy contains the name 'aaaa', which already exists on the destination worksheet. Do you want to use this version of the name? - To use the name as defined in the destination sheet, click Yes - To rename the range referred to in the formula or worksheet, click No, and enter a new name in the Name Conflict dialog box" When I clicked yes, another prompt comes up indicating ...

Subform Data Entry Problems
I have a subform based on a query linked to the Form by "ContactID". The query works fine when run independent of the subform. I am able to enter all data fields and where necessary the autonumber function assigns properly. But when I try to use the subform all records related by my table "tblADDRESS" do not allow data entry (the fields are not locked). I imagine the ContactID Master/Child link in some way is interfering with the query in Form view, but I've tried every variation of join properties within the Query for the Subform and in the Query for the main...

ameritrade plus error
When I try to download my information from ameritrade plus i get a invalid org error. Anyone else experience this problem. Help Please.. >When I try to download my information from ameritrade >plus i get a invalid org error. Anyone else experience >this problem? YES......EVERYONE!!!!!!!!! ...

Link Browser Problems
I have Outlook 2002 as Part of Office XP. I have also installed Service Pack 3. Recently (before and now after the installation of SP3) when I try to open a URL link in an e-mail I get the response that the Link Browser can't be found and it opens the My Documents Folder. Any idea how to fix this?? Thanks. Browse to the location of explorer.exe (or your system default browser) and double click it. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal accoun...

Money2002 Setup Error
When I try to setup (windows98) I get the following: "This program has performed an illegal operation and will be shut down. If the problem persists, contact the program vendor." Here are the details: SETUP executed an invalid instruction in module ADVPACK.DLL at 015f:715f5858. Registers: EAX=0066cf04 CS=015f EIP=715f5858 EFLGS=00010206 EBX=0066d364 SS=0167 ESP=0066cdf4 EBP=0066d014 ECX=0066f8d0 DS=0167 ESI=00000348 FS=6017 EDX=0044003c ES=0167 EDI=0066d350 GS=0000 Bytes at CS:EIP: fe ff ff 50 ff 15 68 11 5f 71 56 8d 85 fc fe ff Stack dump: 00000080 bff77b14 71604004 00667000 0...

OMA Problem Getting Desperate & Running out of Ideas
Hi I am looking to roll out OMA through my corp, but can't seem to solve this prob I am having with logging on I have been through the available papers and there none out there which apply to this or work for it I enabled OMA on my local Exchange 2003 box which is running Server 2000, the OMA directory in IIS contains the correct mailboxes. However when I connect through I.E6 to http://servername:port/oma, I seem to sucessfully logon, but then get then get blocked with a HTTP 500 INTERNAL SERVER ERROR page cannot be displayed screen. I also get this when I browse OMA through IIS. Though I...

ARGGG! OWA Problem
We are using Outlook Web Access with Exchange server 5.5 (on a Windows 2000 computer). For some strange reason, I cannot successfully connect anymore. I get either of the following errors. It's either 1) Failed to get inbox Or 2) Failed to connect to the Microsoft Exchange server, <server name> No other users seem to be affected, just me! I have checked permissions through the IIS management console, and I have even re-applied service pack 4 for Exchange 5.5. I can log on to the network and get my mail through Outlook on the desktop with no problem. I'm stumped! Any...

Release version problems
Hi, I built a release version of my application, and an installer. The application runs fine on my two XP development machines. When I installed it on a windows 2000 machine (SP4) I got the following error when I tried to display a bitmap in my app: "The instruction at "0x00000001" referenced memory at "0x00000001". The memory could not be "read". Then I installed it on another XP machine, and the application crashed and closed itself when performing a certain operation (could also be bitmap related, but not necessarily). I am using the paintlib library in...

Error Occured Trying to Promote this email
This happens when trying to promote a email to CRM activity. Can anyone help? Bob ...

On behalf of problem
No one seems to be able to figure this one out. All my incoming emails are now coming in 'on behalf of' the actual sender. The subject line in there but all of the body of the email is blank. These are all emails senders who regularly send me email and I have done nothing to my Outlook. No one else on my network has this problem but me and it just appeared out of no where. What is the issue here and how can I fix it? Stu. manchu <sjwarkentin@fastmail.fm> wrote: > No one seems to be able to figure this one out. All my incoming > emails are now coming in 'on beh...

Running problem
VWD 2010 I copy all my asp project into a physical location in my pc. Set up a virtual directory under IIS. Open the browser for the main page. eg http://localhost/TestSite20100707/main.aspx Got the error on the page showing the webconfig contents: Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute name...

New User
Using Outlook 2003 with Exchange Server 2000 on XP Pro SP2 - all service packs updated. Attempted to setup a new user account on this system because previous employee has left and need new profile established. When attempt to setup email through Exchange and click 'Check Name' we get the following error: C:\Windows\System32\shell32.dll, Control_RunDLL C:\Program~1\Common~1\system\MSMAPI\1033\MLCFG32.cpl' "@0" The new user account will work fine on another system on the network, so the problem is not with Exchange but with this local system. Have tried deleting the pro...

Exchange 2000 OWA Problem
I can access my Exchange 2000 server via OWA from within the network fine. However when I try and access from outside the network, I can't and receive a "page can't be displayed" error message. I believe my DNS settings are correct, but when I go to http://servername/exchange (using fully qualified domain server name), the error message comes up. Any help would be appreciated. Thanks. Martin On Sat, 27 Aug 2005 16:59:01 -0700, Martin <Martin@discussions.microsoft.com> wrote: >I can access my Exchange 2000 server via OWA from within the network fine. >Ho...

[Excel 2003] problem in files with pivottables after install Office Service Pack 3
Hi all. System: Windows XP Pro SP2, Office 2003 Professional + Service Pack 3 I have a problem with some xls files after install office service pack 3. With service pack 2 this files normal open. With service pack 3 after open file displays dialog (my translate from russian) "In workbook ... have contents which can not be read. Try restore contents of workbook ? If you trust source of this workbook, press button YES". If I press "No" - file not opens. If I press "Yes", displays next dialog. This dialog form content a list of corrections in file. Biggest pa...

Problems with my Dell Inspion with Windows Vista.
Two months ago, my computer was so full of viruses that it had asked me when I was restarting it if I wanted to restore it back to before I was having all of the problems that I was having with it. After I agreed to restoring it, everything worked fine. Two weeks ago, my computer started making me find the files of things I wanted to open before I opened them, example, if I wanted to open Firefox, an Open With pop up would open and would make me go into files and open it manually. But for some reason, it will not open programs period. How can I fix this without completely re-form...

Publisher doc shuts down, no reason, cannot reopen. error
I work in Microsoft Publisher all the time with my publications. Today, my document shut down after saving and when I try to open it, I get a "cannot open Publisher file" message. Help! I have to get my newsletters out today! Thanks How to troubleshoot a damaged publication in Publisher http://support.microsoft.com/kb/198256/en-us -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Charlene" <Charlene@discussions.microsoft.com> wrote in message news:3B4F44C3-02EF-4D86-AD96-95866109453C@microsoft.com... >...

XML Serialization : Error reflecting field.... #2
I have to deserialize an XML document to objects and then serialize it back to XML to pass to the stored proc. I am attaching partial code. After this , I also have to serialize Here is the XML : <data> <orders> <order> <order_id>0</order_id> <issue_id>4460</issue_id> <action>add</action> </order> </orders> </data> This is the main.cs file where I call the Deserializer public class Main { public void AcceptOrdersDom( string strInputXML ) { OrderRootDeSerialize ordRoot =(OrderRootDeSerializ...

Misleading VS.NET 2003 error message
I got this error message compiler under VS.NET 2003 (no, I haven't tried it under 2005) ParseTrace.cpp i:\mvp_tips\Parser\RDParser\ParseTrace.h(42) : error C2226: syntax error : unexpected type 'BOOL' i:\mvp_tips\Parser\RDParser\ParseTrace.h(42) : error C2238: unexpected token(s) preceding ';' from the following class definition class AFX_EXT_CLASS StackTrace { public: StackTrace(BOOL pushing, TreeNode * n); // <= error was on this line ~StackTrace(); CString ToString(); }; Now try to guess what is wrong. What is wrong is that I forget to ...