I have recently taken over a VBA app. I have never done VBA before only VB hitting an access database.

The VBA / access prog works fine on the users machine and has been running for a number of months. When I run the app on my machine ( where I have VB 5 installed )it bombs out here.

Private Declare Function apiSHFileOperation Lib "Shell32.dll" _
Alias "SHFileOperationA" _
(lpFileOp As SHFILEOPSTRUCT) _
As Long

the sub that creates a new .dat file for output bombs out and highlights the above code in a module.With the error message : user defined type not defined

I looked in my VB5 API text viewer and couldnt find a match for apiSHFileOperation but there was one for SHFileOperation
so I took the api of the start of the private declare function so it now looks like this:

Private Declare Function SHFileOperation Lib "Shell32.dll" _
Alias "SHFileOperationA" _
(lpFileOp As SHFILEOPSTRUCT) _
As Long

this now allows the creation of the file and it appears in the correct directory on my HD. Is this something to do with VBA and VB5 being different development platforms. Why does it work with the the API prefix on the users machine and not on mine ? can anyone explain this to me ?. And when I give the prog back to them ( I am making some minor changes to it ) will it now not work on thier machine until I put the api prefix back on where I took it off on mine.
Does this make sense ?.


part two ( groan )
straight after creating the file the prog goes to another sub called make back up :

Public Function MakeBackUp(ByVal bvDatabase As Database, ByVal bvBackupDatabase As String) As Boolean
Dim strMsg As String
Dim tshFileOp As SHFILEOPSTRUCT
Dim lngRet As Long
Dim strSaveFile As String
Dim lngFlags As Long

Const cERR_USER_CANCEL = vbObjectError + 1
Const cERR_DB_EXCLUSIVE = vbObjectError + 2

On Local Error GoTo MakeBackup_Err

If DBExclusive(bvDatabase) = True Then
Err.Raise cERR_DB_EXCLUSIVE
End If

lngFlags = FOF_SIMPLEPROGRESS Or _
FOF_FILESONLY Or _
FOF_RENAMEONCOLLISION

strSaveFile = CurrentDBDir & bvBackupDatabase & ".mdb"
With tshFileOp
.wFunc = FO_COPY
.hwnd = hWndAccessApp
.pFrom = bvDatabase.Name & vbNullChar
.pTo = strSaveFile & vbNullChar
.fFlags = lngFlags
End With


******************** again here I took out the api in front
******************** of the SHFile...
********Now the program stops at this line with a message ********about memory

***stops here** lngRet = SHFileOperation(tshFileOp)
MakeBackUp = (lngRet = 0)

MakeBackup_End:
Exit Function
MakeBackup_Err:
MakeBackUp = False
Select Case Err.Number
Case cERR_USER_CANCEL:
'do nothing
Case cERR_DB_EXCLUSIVE:
MsgBox "The current database " & vbCrLf & bvDatabase.Name & vbCrLf & _
vbCrLf & "is opened exclusively. Please reopen in shared mode" & _
" and try again.", vbCritical + vbOKOnly, "Database copy failed"
Case Else:
strMsg = "Error Information..." & vbCrLf & vbCrLf
strMsg = strMsg & "Function: MakeBackup" & vbCrLf
strMsg = strMsg & "Description: " & Err.Description & vbCrLf
strMsg = strMsg & "Error #: " & Format$(Err.Number) & vbCrLf
MsgBox strMsg, vbInformation, "MakeBackup"
End Select
Resume MakeBackup_End

End Function



The error message is as follows:
MSAccess.exe appliucation error
The instruction at "0x77f34cab" referenced memory at "0x01900000" the memory could not be "read"
Any idea's what this means or what could be causing it ?

Help me OB1 , your my only hope.

Thanx
Locutus