PC Review


Reply
Thread Tools Rate Thread

DoCmd.TransferDatabase run-time error 2501

 
 
Matt Tatham
Guest
Posts: n/a
 
      24th Mar 2010
I'm hoping someone out there can help me with this.

I have several databases created using Access 2000. I'm using a transfer
utility developed by a contractor of some years ago for our company to update
the production databases we have at remote locations. I have used it without
error or problem for two years and it started hanging up, giving me this
error:

Run-time error '2501'
TransferDatabase was cancelled

I've been running through the knowledge base and online help to try and find
out why this was occurring. All I've been able to do so far is trap the
error and exit gracefully. My code originally looked like this:

Private Sub Command0_Click()

MsgBox "start"
DoCmd.TransferDatabase (acExport), "Microsoft Access", "H:\MfgInfo.mdb",
acModule, "Global", "Global", False
DoCmd.TransferDatabase (acExport), "Microsoft Access", "H:\MfgInfo.mdb",
acForm, "Schedule", "Schedule", False
MsgBox "finished"

End Sub

Using the help I found online, I added error trapping thusly:

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click

MsgBox "start"
DoCmd.TransferDatabase (acExport), "Microsoft Access", "\H:\MfgInfo.mdb",
acModule, "Global", "Global", False
DoCmd.TransferDatabase (acExport), "Microsoft Access", "H:\MfgInfo.mdb",
acForm, "Schedule", "Schedule", False

MsgBox "finished"

Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
If Err.Number = 2501 Then
MsgBox "IS 2501"
Resume Exit_Command0_Click
Else
MsgBox "NOT 2501"
Resume Exit_Command0_Click
End If

End Sub

I can now see when the error occurs and my program doesn't crash, but I have
zero information on why the error is occurring and how I can resolve it so
that the TransferDatabase can actually function.

Any help is greatly appreciated.

Matt Tatham
 
Reply With Quote
 
 
 
 
Dorian
Guest
Posts: n/a
 
      24th Mar 2010
Maybe drive H: does not exist on the computer running this.
Never use mapped drive letters in an application, always use a path to the
server e.g.
\\servername\foldername
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


"Matt Tatham" wrote:

> I'm hoping someone out there can help me with this.
>
> I have several databases created using Access 2000. I'm using a transfer
> utility developed by a contractor of some years ago for our company to update
> the production databases we have at remote locations. I have used it without
> error or problem for two years and it started hanging up, giving me this
> error:
>
> Run-time error '2501'
> TransferDatabase was cancelled
>
> I've been running through the knowledge base and online help to try and find
> out why this was occurring. All I've been able to do so far is trap the
> error and exit gracefully. My code originally looked like this:
>
> Private Sub Command0_Click()
>
> MsgBox "start"
> DoCmd.TransferDatabase (acExport), "Microsoft Access", "H:\MfgInfo.mdb",
> acModule, "Global", "Global", False
> DoCmd.TransferDatabase (acExport), "Microsoft Access", "H:\MfgInfo.mdb",
> acForm, "Schedule", "Schedule", False
> MsgBox "finished"
>
> End Sub
>
> Using the help I found online, I added error trapping thusly:
>
> Private Sub Command0_Click()
> On Error GoTo Err_Command0_Click
>
> MsgBox "start"
> DoCmd.TransferDatabase (acExport), "Microsoft Access", "\H:\MfgInfo.mdb",
> acModule, "Global", "Global", False
> DoCmd.TransferDatabase (acExport), "Microsoft Access", "H:\MfgInfo.mdb",
> acForm, "Schedule", "Schedule", False
>
> MsgBox "finished"
>
> Exit_Command0_Click:
> Exit Sub
>
> Err_Command0_Click:
> If Err.Number = 2501 Then
> MsgBox "IS 2501"
> Resume Exit_Command0_Click
> Else
> MsgBox "NOT 2501"
> Resume Exit_Command0_Click
> End If
>
> End Sub
>
> I can now see when the error occurs and my program doesn't crash, but I have
> zero information on why the error is occurring and how I can resolve it so
> that the TransferDatabase can actually function.
>
> Any help is greatly appreciated.
>
> Matt Tatham

 
Reply With Quote
 
ryguy7272
Guest
Posts: n/a
 
      24th Mar 2010
The run-time error 2501 error means something was cancelled; some operation
was canceled. In this case, it is the TransferDatabase operation. Something
that should exist probably does not exist. What changed recently? Think
about it. Also, go into edit mode, Alt+F11, set some break points, click the
'Command0' button and f* through the code. Notice where the error occurs.
That's your answer.



--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Dorian" wrote:

> Maybe drive H: does not exist on the computer running this.
> Never use mapped drive letters in an application, always use a path to the
> server e.g.
> \\servername\foldername
> -- Dorian
> "Give someone a fish and they eat for a day; teach someone to fish and they
> eat for a lifetime".
>
>
> "Matt Tatham" wrote:
>
> > I'm hoping someone out there can help me with this.
> >
> > I have several databases created using Access 2000. I'm using a transfer
> > utility developed by a contractor of some years ago for our company to update
> > the production databases we have at remote locations. I have used it without
> > error or problem for two years and it started hanging up, giving me this
> > error:
> >
> > Run-time error '2501'
> > TransferDatabase was cancelled
> >
> > I've been running through the knowledge base and online help to try and find
> > out why this was occurring. All I've been able to do so far is trap the
> > error and exit gracefully. My code originally looked like this:
> >
> > Private Sub Command0_Click()
> >
> > MsgBox "start"
> > DoCmd.TransferDatabase (acExport), "Microsoft Access", "H:\MfgInfo.mdb",
> > acModule, "Global", "Global", False
> > DoCmd.TransferDatabase (acExport), "Microsoft Access", "H:\MfgInfo.mdb",
> > acForm, "Schedule", "Schedule", False
> > MsgBox "finished"
> >
> > End Sub
> >
> > Using the help I found online, I added error trapping thusly:
> >
> > Private Sub Command0_Click()
> > On Error GoTo Err_Command0_Click
> >
> > MsgBox "start"
> > DoCmd.TransferDatabase (acExport), "Microsoft Access", "\H:\MfgInfo.mdb",
> > acModule, "Global", "Global", False
> > DoCmd.TransferDatabase (acExport), "Microsoft Access", "H:\MfgInfo.mdb",
> > acForm, "Schedule", "Schedule", False
> >
> > MsgBox "finished"
> >
> > Exit_Command0_Click:
> > Exit Sub
> >
> > Err_Command0_Click:
> > If Err.Number = 2501 Then
> > MsgBox "IS 2501"
> > Resume Exit_Command0_Click
> > Else
> > MsgBox "NOT 2501"
> > Resume Exit_Command0_Click
> > End If
> >
> > End Sub
> >
> > I can now see when the error occurs and my program doesn't crash, but I have
> > zero information on why the error is occurring and how I can resolve it so
> > that the TransferDatabase can actually function.
> >
> > Any help is greatly appreciated.
> >
> > Matt Tatham

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DoCmd.CopyObject Error 2501 Cory Microsoft Access VBA Modules 3 24th Nov 2008 08:38 PM
Error Run-time '2501' in method execution: DoCmd.save acReport, "N =?Utf-8?B?TWFyY3VzIEJ1bGhvc2EgLyBBbmFsaXN0YSBDRUY= Microsoft Access VBA Modules 0 21st Jul 2006 07:53 PM
Re: Transferdatabase canceled, error 2501 TC Microsoft Access VBA Modules 0 11th Apr 2006 05:13 AM
Transferdatabase canceled, error 2501 sTeve Microsoft Access Form Coding 1 11th Apr 2006 05:13 AM
Transferdatabase canceled, error 2501 sTeve Microsoft Access VBA Modules 3 11th Apr 2006 04:52 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:53 PM.