Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Visual Basic error 32

Posted on 2004-09-08
5
934 Views
Last Modified: 2013-11-25
Receiving this error while trying to put file on our unix server. Seems to connect just fine and does a directory change, just errors while trying to put the file.

Any help would be appriciated!
0
Comment
Question by:campbelc
  • 2
  • 2
5 Comments
 
LVL 32

Expert Comment

by:Erick37
ID: 12007110
What is the exact error message?
How are you connecting to the server?
0
 
LVL 6

Author Comment

by:campbelc
ID: 12007991
The returned error code is 32. No error text is returned.

The InternetOpen works just fine and returns 13369348.
The InternetConnect works just fine and returns 13369352.
The FtpSetCurrentDirectory works just fine and returns true.
I can easily test any of the above simply by providing invalid values, which as expected result in failure return codes.

The FtpPutFile fails. It returns false, and the last error code is 32 as noted above. No text is returned.

I have multiple examples of VB source code. All work just dandy. All transfer the test file just fine. I have used code from each of these examples in my target program, and the result is always as noted above. I've compared variable contents value-for-value between the working and target programs, variable types and everything else I can think of. Obviously something is different between several working source codes and my target program, but I'm damned if I can find a difference.

Any suggestions would be appreciated. Thanks!
0
 
LVL 32

Accepted Solution

by:
Erick37 earned 150 total points
ID: 12008542
OK,

Assuming that the error number 32 is derived from calling err.lastDLLerror immediately after the call to FtpPutFile, you can get the text of the error with this function:

Private Declare Function FormatMessage Lib "kernel32" _
      Alias "FormatMessageA" (ByVal dwFlags As Long, _
      lpSource As Any, ByVal dwMessageId As Long, _
      ByVal dwLanguageId As Long, ByVal lpBuffer As String, _
      ByVal nSize As Long, Arguments As Long) As Long
   
Private Const FORMAT_MESSAGE_FROM_SYSTEM As Long = &H1000

'----------------------------------------------------------------------------
Private Function ApiErrorText(ByVal ErrNum As Long) As String
      Dim msg As String
      Dim nRet As Long
   
      msg = Space$(1024)
      nRet = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, ByVal 0&, _
                           ErrNum, 0&, msg, Len(msg), ByVal 0&)
      If nRet Then
         ApiErrorText = Left$(msg, nRet)
      Else
         ApiErrorText = "Error (" & ErrNum & ") not defined."
      End If
End Function
'----------------------------------------------------------------------------

Plugging in the number 32 results in the text message:
"The process cannot access the file because it is being used by another process."

That's all I have so far... still searching for an answer.
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 12008566
Have you tried this program

http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3BQ175179


May be there is security problem have you tried to connect via just


ftp


run from command prompt?
0
 
LVL 6

Author Comment

by:campbelc
ID: 12009073
oh. ouch.

That's it, absolutely. The target program hadn't closed the file. Program worked immediately when I explicitly closed the file.

That's why the other sources worked fine, because the program I was developing wasn't running and holding the file open.

Thanks!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question