Error 64 bit ??

syedadnan

Access Lover
Local time
Today, 13:54
Joined
Mar 27, 2013
Messages
315
Regards,

I have a database in A2010 i have just changed my windows and office 2010 and after this change i ma getting this error at opening of this program.. the error is attached as snap..

I am not very smart in access so it would be pleasure having a descriptive solution.
 

Attachments

  • Untitled.png
    Untitled.png
    77.5 KB · Views: 122
do an IF to determine which bit you need:
for 64 bit use PTRSAFE

#If Vba7 Then
Declare PtrSafe Sub...
#Else
Declare Sub...
#EndIf
 
yes, much better:
Code:
 #if Win64 then
   Declare PtrSafe Function MyMathFunc Lib "User32" (ByVal N As LongLong) As LongLong
#else
   Declare Function MyMathFunc Lib "User32" (ByVal N As Long) As Long
#end if
 
Code:
#If Win64 Then
Private Declare PtrSafe Function apiGetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
#Else
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias "GetUserNameA" (Byval lpBuffer As String, nSize As Long) As Long
#End If

Public Function fOSUserName() As String
' Return the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If (lngX > 0) Then
    fOSUserName = Left$(strUserName, lngLen - 1)
Else
    fOSUserName = vbNullString
End If
End Function

or simply use, no need API calls:

Environ("UserName")
 

Users who are viewing this thread

Back
Top Bottom