Stuart McLachlan
stuart at lexacorp.com.pg
Sat Jun 9 16:35:08 CDT 2012
Yep, 64bit Office with calls toi 32bit API functions is the problem. The fix is fairly simple. Here's a example of what you need to do (from one of my apps using similar functions). #If VBA7 Then Private Declare PtrSafe Function GetTempPath Lib "kernel32" Alias "GetTempPathA" _ (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long Declare PtrSafe Function GetOpenFileName Lib "comdlg32.dll" Alias _ "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long Private Declare PtrSafe Function apiGetUserName Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Public Declare PtrSafe Function ShellExecute Lib "SHELL32.DLL" Alias _ "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long #Else Declare Function GetOpenFileName Lib "comdlg32.dll" Alias _ GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Public Declare Function ShellExecute Lib "SHELL32.DLL" Alias _ "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long #End If On 9 Jun 2012 at 5:01, rockysmolin at bchacc.com wrote: > forgot to send plain text. > > R > > > > -------- Original Message -------- > Subject: RE: [AccessD] New Computer Gives Error > From: <rockysmolin at bchacc.com> > Date: Sat, June 09, 2012 5:01 am > To: "Access Developers discussion and problem solving" > <accessd at databaseadvisors.com> > > Further here are the Declares in the app - most are from the ADH 2003. > Adding PtrSafe creates a compile error - So I'm thinking that's an > Access 2010 reserved word. > > > Declare Function adh_apiGetOpenFileName Lib "comdlg32.dll" _ > Alias "GetOpenFileNameA" (ofn As tagOPENFILENAME) As Boolean > > Declare Function adh_apiGetSaveFileName Lib "comdlg32.dll" _ > Alias "GetSaveFileNameA" (ofn As tagOPENFILENAME) As Boolean > > > Declare Function ShellExecute Lib "shell32.dll" Alias _ > "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation _ > As String, ByVal lpFile As String, ByVal lpParameters _ > As String, ByVal lpDirectory As String, ByVal nShowCmd _ > As Long) As Long > > > Private Declare Function ts_apiGetOpenFileName Lib "comdlg32.dll" _ > Alias "GetOpenFileNameA" (tsFN As tsFileName) As Boolean > > Private Declare Function ts_apiGetSaveFileName Lib "comdlg32.dll" _ > Alias "GetSaveFileNameA" (tsFN As tsFileName) As Boolean > > Private Declare Function CommDlgExtendedError Lib "comdlg32.dll" () As > Long > > > Private Declare Function SHGetPathFromIDList Lib "shell32.dll" _ > Alias "SHGetPathFromIDListA" (ByVal pidl As Long, _ > ByVal pszPath As String) As Long > > Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" _ > (ByVal hwndOwner As Long, ByVal nFolder As Long, _ > pidl As ITEMIDLIST) As Long > > Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias _ > "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long > > > Declare Function adh_apiDeleteDC Lib "gdi32" _ > Alias "DeleteDC" (ByVal hdc As Long) As Long > Declare Function adh_apiGetDeviceCaps Lib "gdi32" _ > Alias "GetDeviceCaps" (ByVal hdc As Long, _ > ByVal nIndex As Long) As Long > Declare Function adh_apiGetClientRect Lib "USER32" _ > Alias "GetClientRect" (ByVal hWnd As Long, _ > lpRect As adhTypeRect) As Long > Declare Function adh_apiIsIconic Lib "USER32" _ > Alias "IsIconic" (ByVal hWnd As Long) As Long > Declare Function adh_apiMoveWindow Lib "USER32" _ > Alias "MoveWindow" (ByVal hWnd As Long, _ > ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, _ > ByVal nHeight As Long, ByVal bRepaint As Long) As Long > Declare Function adh_apiGetSystemMetrics Lib "USER32" _ > Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long > Declare Function adh_apiCreateIC Lib "gdi32" _ > Alias "CreateICA" (ByVal lpDriverName As String, _ > ByVal lpDeviceName As String, ByVal lpOutput As String, _ > lpInitData As Any) As Long > Declare Function adh_apiGetWindowRect Lib "USER32" _ > Alias "GetWindowRect" (ByVal hWnd As Long, _ > lpRect As adhTypeRect) As Long > Declare Function adh_apiGetParent Lib "USER32" _ > Alias "GetParent" (ByVal hWnd As Long) As Long > Declare Function adh_apiGetOpenFileName Lib "comdlg32.dll" _ > Alias "GetOpenFileNameA" (ofn As tagOPENFILENAME) As Boolean > Declare Function adh_apiGetSaveFileName Lib "comdlg32.dll" _ > Alias "GetSaveFileNameA" (ofn As tagOPENFILENAME) As Boolean > Declare Function CommDlgExtendedError Lib "comdlg32.dll" () As Long > Declare Function adhChooseCOlor Lib "msaccess.exe" _ > Alias "#53" (ByVal hWnd As Long, RGB As Long) As Long > > Private Declare Function apiMessageBoxW Lib "user32.dll" Alias > "MessageBoxW" _ > (ByVal hWnd As Long, ByVal Txt As String, _ > ByVal Caption As String, ByVal Typ As Integer) As Integer > > > -------- Original Message -------- > Subject: [AccessD] New Computer Gives Error > From: <rockysmolin at bchacc.com> > Date: Sat, June 09, 2012 4:42 am > To: "Access Developers discussion and problem solving" > <accessd at databaseadvisors.com> > > Dear List: > > I am out of town until the 17th so figuring out what's wrong with an > app > that has been running fine and now doesn't is awkward. > > The user got a new computer with (I think) W7 and new Office (but he > doesn't know which version) and sent me the screen shot he gets when he > tries to open the app. > > The error reads:"The expression you entered as the event property > setting produced the following error code: the code in this project > must > be updated for use on 64-bit systems. Please review and update Declare > statements and then mark them with the PtrSafe attribute." > > Is he running the 64-bit Office and needs to load 32-bit version > instead? > > MTIA, > > Rocky > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- Stuart McLachlan Ph: +675 340 4392 Mob: +675 7100 2028 Web: http://www.lexacorp.com.pg