Home

compile error. The code in this project must be updated for use on 64-bit systems.

%3CLINGO-SUB%20id%3D%22lingo-sub-476949%22%20slang%3D%22en-US%22%3Ecompile%20error.%20The%20code%20in%20this%20project%20must%20be%20updated%20for%20use%20on%2064-bit%20systems.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-476949%22%20slang%3D%22en-US%22%3E%3CP%3Ehello%20all%20I%20am%20IT%20challenged%20and%20would%20really%20appreciate%20any%20help%20-thank%20you.%26nbsp%3B%20I%20have%20a%20new%20laptop%20and%20I%20am%20trying%20to%20open%20up%20my%20Access%20program%20which%20ran%20on%20my%20old%20laptop.%26nbsp%3B%20I%20get%20this%20message%3A%26nbsp%3B%20Compile%20error%3A%26nbsp%3B%20The%20code%20in%20this%20project%20must%20be%20updated%20for%20use%20on%2064-bit%20systems.%26nbsp%3B%20Please%20review%20and%20update%20Declare%20statements%20and%20then%20mark%20them%20with%20the%20PtrSafe%20attribute.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethis%20is%20on%20the%20screen%20behind%20it%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%3E%3CFONT%3EOption%20Compare%20Database%3CBR%20%2F%3EOption%20Explicit%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%3EGlobal%20glngJobDescID%20As%20Variant%3CBR%20%2F%3EGlobal%20gstrJobDescNo%20As%20String%3CBR%20%2F%3EGlobal%20gstrUserName%20As%20String%3CBR%20%2F%3EGlobal%20glngNewNumber%20As%20Long%3CBR%20%2F%3EGlobal%20gstrCriteria%20As%20String%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%3EPrivate%20Declare%20Function%20apiGetUserName%20Lib%20%22advapi32.dll%22%20Alias%20_%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22GetUserNameA%22%20(ByVal%20lpBuffer%20As%20String%2C%20nSize%20As%20Long)%20As%20Long%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%3EDeclare%20Function%20SetWindowText%20Lib%20%22user32%22%20Alias%20%22SetWindowTextA%22%20_%3CBR%20%2F%3E%26nbsp%3B%20(ByVal%20hwnd%20As%20Long%2C%20ByVal%20lpString%20As%20String)%20As%20Long%3CBR%20%2F%3E%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%20Private%20Declare%20Function%20apiGetComputerName%20Lib%20%22kernel32%22%20Alias%20_%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22GetComputerNameA%22%20(ByVal%20lpBuffer%20As%20String%2C%20nSize%20As%20Long)%20As%20Long%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%3EFunction%20isLoaded(strFrmName%20As%20String)%20As%20Boolean%3CBR%20%2F%3E%26nbsp%3B%20'isLoaded%20%3D%20SysCmd(SYSCMD_GETOBJECTSTATE%2C%20acForm%2C%20strFrmName)%3CBR%20%2F%3E%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%20If%20CurrentProject.AllForms(strFrmName).isLoaded%20Then%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20If%20Forms(strFrmName).CurrentView%20%26gt%3B%200%20Then%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20'loaded%20in%20any%20view%20aside%20from%20DESIGN%20VIEW%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20isLoaded%20%3D%20True%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20End%20If%3CBR%20%2F%3EEnd%20If%3CBR%20%2F%3EEnd%20Function%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%3EFunction%20ShowCurrentUser()%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20MsgBox%20%22The%20Current%20User%20is%3A%20%22%20%26amp%3B%20CurrentUser()%3CBR%20%2F%3EEnd%20Function%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%3EFunction%20fOSUserName()%20As%20Variant%3CBR%20%2F%3E%26nbsp%3B%20Dim%20lngLen%20As%20Long%2C%20lngX%20As%20Long%3CBR%20%2F%3E%26nbsp%3B%20Dim%20strUserName%20As%20String%3CBR%20%2F%3E%26nbsp%3B%20Dim%20rs%20As%20Recordset%3CBR%20%2F%3E%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%20strUserName%20%3D%20String%24(254%2C%200)%3CBR%20%2F%3E%26nbsp%3B%20lngLen%20%3D%20255%3CBR%20%2F%3E%26nbsp%3B%20lngX%20%3D%20apiGetUserName(strUserName%2C%20lngLen)%3CBR%20%2F%3E%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%20If%20lngX%20%26lt%3B%26gt%3B%200%20Then%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20fOSUserName%20%3D%20Left%24(strUserName%2C%20lngLen%20-%201)%3CBR%20%2F%3E%26nbsp%3B%20Else%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20fOSUserName%20%3D%20%22Anonymous%40%22%20%26amp%3B%20fOSMachineName()%3CBR%20%2F%3E%26nbsp%3B%20End%20If%3CBR%20%2F%3E%26nbsp%3B%20Set%20rs%20%3D%20Nothing%3CBR%20%2F%3EEnd%20Function%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%3EFunction%20SetGrpFtrLoc(rpt%20As%20Access.Report%2C%20dblGrpFtrLoc%20As%20Double)%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%3E%26nbsp%3B%26nbsp%3B%20'Convert%20inches%20to%20twips%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20'dblGrpFtrLoc%20%3D%20dblGrpFtrLoc%20*%201440%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20'Convert%20centimeters%20to%20twips%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20dblGrpFtrLoc%20%3D%20dblGrpFtrLoc%20*%20567%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20If%20rpt.Top%20%26lt%3B%20dblGrpFtrLoc%20Then%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20rpt.MoveLayout%20%3D%20True%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20rpt.NextRecord%20%3D%20False%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20rpt.PrintSection%20%3D%20False%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20End%20If%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%3EEnd%20Function%3CBR%20%2F%3EFunction%20fSelModule(stModule)%20As%20String%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%3E%26nbsp%3B%20If%20IsNumeric(Mid(stModule%2C%203%2C%201))%20Then%20fSelModule%20%3D%20stModule%20Else%20fSelModule%20%3D%20Left(stModule%2C%202)%3CBR%20%2F%3E%26nbsp%3B%3CBR%20%2F%3EEnd%20Function%3CBR%20%2F%3EFunction%20CreateQuery(strQryName%20As%20String%2C%20strSQL%20As%20String)%20As%20Boolean%3CBR%20%2F%3EOn%20Error%20GoTo%20CreateQuery_Error%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%3E%26nbsp%3B%20Dim%20db%20As%20Database%3CBR%20%2F%3E%26nbsp%3B%20Dim%20qdf%20As%20QueryDef%3CBR%20%2F%3E%26nbsp%3B%20Dim%20intErr%20As%20Integer%3CBR%20%2F%3E%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%20On%20Error%20Resume%20Next%3CBR%20%2F%3E%26nbsp%3B%20Set%20db%20%3D%20CurrentDb()%3CBR%20%2F%3E%26nbsp%3B%20Set%20qdf%20%3D%20db.CreateQueryDef(strQryName%2C%20strSQL)%3CBR%20%2F%3E%26nbsp%3B%20intErr%20%3D%20Err%3CBR%20%2F%3E%26nbsp%3B%20If%20intErr%20%26lt%3B%26gt%3B%200%20Then%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Set%20qdf%20%3D%20Nothing%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20DoCmd.DeleteObject%20acQuery%2C%20strQryName%3CBR%20%2F%3E%26nbsp%3B%20Else%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20CreateQuery%20%3D%20True%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20GoTo%20CreateQuery_Exit%3CBR%20%2F%3E%26nbsp%3B%20End%20If%3CBR%20%2F%3E%26nbsp%3B%20On%20Error%20GoTo%20CreateQuery_Error%3CBR%20%2F%3E%26nbsp%3B%20Set%20qdf%20%3D%20db.CreateQueryDef(strQryName%2C%20strSQL)%3CBR%20%2F%3E%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%20CreateQuery%20%3D%20True%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%3ECreateQuery_Exit%3A%3CBR%20%2F%3E%26nbsp%3B%20Set%20qdf%20%3D%20Nothing%3CBR%20%2F%3E%26nbsp%3B%20Set%20db%20%3D%20Nothing%3CBR%20%2F%3E%26nbsp%3B%20Exit%20Function%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%3ECreateQuery_Error%3A%3CBR%20%2F%3E%26nbsp%3B%20CreateQuery%20%3D%20False%3CBR%20%2F%3E%26nbsp%3B%20MsgBox%20%22OOPS!%20a%20Query%20Error%22%20%26amp%3B%20Chr(13)%20%26amp%3B%20Err%20%26amp%3B%20%22%3A%20%22%20%26amp%3B%20Err.Description%2C%20vbCritical%2C%20%22Create%20Query%22%3CBR%20%2F%3E%26nbsp%3B%20Resume%20CreateQuery_Exit%3CBR%20%2F%3E%26nbsp%3B%3CBR%20%2F%3EEnd%20Function%3CBR%20%2F%3EFunction%20fOSMachineName()%20As%20String%3CBR%20%2F%3E'%20This%20code%20was%20originally%20written%20by%20Dev%20Ashish.%3CBR%20%2F%3E'%20It%20is%20not%20to%20be%20altered%20or%20distributed%2C%3CBR%20%2F%3E'%20except%20as%20part%20of%20an%20application.%3CBR%20%2F%3E'%20You%20are%20free%20to%20use%20it%20in%20any%20application%2C%3CBR%20%2F%3E'%20provided%20the%20copyright%20notice%20is%20left%20unchanged.%3CBR%20%2F%3E'%3CBR%20%2F%3E'%20Code%20Courtesy%20of%3CBR%20%2F%3E'%20Dev%20Ashish%3CBR%20%2F%3E'%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%3CFONT%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%3CBR%20%2F%3E'Returns%20the%20computername%3CBR%20%2F%3EDim%20lngLen%20As%20Long%2C%20lngX%20As%20Long%3CBR%20%2F%3EDim%20strCompName%20As%20String%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20lngLen%20%3D%2016%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20strCompName%20%3D%20String%24(lngLen%2C%200)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20lngX%20%3D%20apiGetComputerName(strCompName%2C%20lngLen)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20If%20lngX%20%26lt%3B%26gt%3B%200%20Then%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20fOSMachineName%20%3D%20Left%24(strCompName%2C%20lngLen)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Else%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20fOSMachineName%20%3D%20%22%22%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20End%20If%3CBR%20%2F%3EEnd%20Function%3C%2FFONT%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-476949%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAccess%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
tereseschuts
Occasional Visitor

hello all I am IT challenged and would really appreciate any help -thank you.  I have a new laptop and I am trying to open up my Access program which ran on my old laptop.  I get this message:  Compile error:  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.

 

this is on the screen behind it

 

Option Compare Database
Option Explicit
Global glngJobDescID As Variant
Global gstrJobDescNo As String
Global gstrUserName As String
Global glngNewNumber As Long
Global gstrCriteria As String
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
    "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" _
  (ByVal hwnd As Long, ByVal lpString As String) As Long
 
  Private Declare Function apiGetComputerName Lib "kernel32" Alias _
    "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function isLoaded(strFrmName As String) As Boolean
  'isLoaded = SysCmd(SYSCMD_GETOBJECTSTATE, acForm, strFrmName)
 
  If CurrentProject.AllForms(strFrmName).isLoaded Then
    If Forms(strFrmName).CurrentView > 0 Then
        'loaded in any view aside from DESIGN VIEW
        isLoaded = True
    End If
End If
End Function
Function ShowCurrentUser()
    MsgBox "The Current User is: " & CurrentUser()
End Function
Function fOSUserName() As Variant
  Dim lngLen As Long, lngX As Long
  Dim strUserName As String
  Dim rs As Recordset
 
  strUserName = String$(254, 0)
  lngLen = 255
  lngX = apiGetUserName(strUserName, lngLen)
 
  If lngX <> 0 Then
      fOSUserName = Left$(strUserName, lngLen - 1)
  Else
      fOSUserName = "Anonymous@" & fOSMachineName()
  End If
  Set rs = Nothing
End Function
Function SetGrpFtrLoc(rpt As Access.Report, dblGrpFtrLoc As Double)
   'Convert inches to twips
   'dblGrpFtrLoc = dblGrpFtrLoc * 1440
  
   'Convert centimeters to twips
   dblGrpFtrLoc = dblGrpFtrLoc * 567
  
   If rpt.Top < dblGrpFtrLoc Then
      rpt.MoveLayout = True
      rpt.NextRecord = False
      rpt.PrintSection = False
   End If
End Function
Function fSelModule(stModule) As String
  If IsNumeric(Mid(stModule, 3, 1)) Then fSelModule = stModule Else fSelModule = Left(stModule, 2)
 
End Function
Function CreateQuery(strQryName As String, strSQL As String) As Boolean
On Error GoTo CreateQuery_Error
  Dim db As Database
  Dim qdf As QueryDef
  Dim intErr As Integer
 
  On Error Resume Next
  Set db = CurrentDb()
  Set qdf = db.CreateQueryDef(strQryName, strSQL)
  intErr = Err
  If intErr <> 0 Then
    Set qdf = Nothing
    DoCmd.DeleteObject acQuery, strQryName
  Else
    CreateQuery = True
    GoTo CreateQuery_Exit
  End If
  On Error GoTo CreateQuery_Error
  Set qdf = db.CreateQueryDef(strQryName, strSQL)
 
  CreateQuery = True
CreateQuery_Exit:
  Set qdf = Nothing
  Set db = Nothing
  Exit Function
CreateQuery_Error:
  CreateQuery = False
  MsgBox "OOPS! a Query Error" & Chr(13) & Err & ": " & Err.Description, vbCritical, "Create Query"
  Resume CreateQuery_Exit
 
End Function
Function fOSMachineName() As String
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
   
'Returns the computername
Dim lngLen As Long, lngX As Long
Dim strCompName As String
    lngLen = 16
    strCompName = String$(lngLen, 0)
    lngX = apiGetComputerName(strCompName, lngLen)
    If lngX <> 0 Then
        fOSMachineName = Left$(strCompName, lngLen)
    Else
        fOSMachineName = ""
    End If
End Function
 

 

 

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies