简体   繁体   中英

Kernel32 issue with MS Access 2010 on Windows Server 2003 32-bit

Hi I have recently installed MS Access 2010 on my Windows Server 2003 32-bit. Since then one of my VBA scripts isn't running properly. MS Access is quitting unexpectedly giving this error with Kernel32 module. 在此处输入图片说明

I have used this line in my VBA code.

Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
         lpApplicationName As Long, ByVal lpCommandLine As String, ByVal _
         lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
         ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
         ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, _
         lpStartupInfo As STARTUPINFO, lpProcessInformation As _
         PROCESS_INFORMATION) As Long

Previously I use to have MS Access 2003 version and I never had any problem. Is there any compatibility issue with MS Access 2010-Windows Server 2003-Kernel32. Please help. Thanks

While I can't offer any specific guidance regarding the kernel32 issue you have encountered, I would make the recommendation that you start eliminating 32-bit Windows API calls from your code. Such calls will prevent your code from compiling under 64-bit versions of Access unless you tweak the declarations to make them "pointer safe" (ref: here ), and in many of the more common cases where Win32 API calls were used there are more generic methods available now, like the FileDialog object for manipulating "File Open" and "File Save" dialogs.

In this case I would investigate the .Exec and .Run methods of the WScript.Shell object. There is a description of those methods (and the differences between them) here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM