Share via

Issue when opening access

Anonymous
2022-10-31T13:43:48+00:00

HiAll

I just had my pc updated and just opened a database and it wouldn't open as normal and I manage to get in the BE and all this code was in red?

I do not have a clue, Only thing I have is this: The icons for SPMS.accdb and QPCS15Rollers.mdb are different. QPCS15Rollers.mdb opens okay.

' ********************************

' VB6 RUNTIMES must be present to resolve this call

' Returns address of the address of the associated SafeArray descriptor

Private Declare Function VarPtrArray Lib "msvbvm60.dll" Alias "VarPtr" ( _

ptr() As Any) As Long 

'*********************************************************************

Private Declare Function GetActiveWindow Lib "user32" () As Long

Private Declare Function GetDoubleClickTime Lib "user32" () As Long

Private Declare Function GetMessageTime Lib "user32" () As Long

Private Declare Function SetProp Lib "user32" Alias "SetPropA" _

(ByVal hWnd As Long, ByVal lpString As String, ByVal hData As Long) As Long

Private Declare Function GetProp Lib "user32" Alias "GetPropA" _

(ByVal hWnd As Long, ByVal lpString As String) As Long

Private Declare Function RemoveProp Lib "user32" Alias "RemovePropA" _

(ByVal hWnd As Long, ByVal lpString As String) As Long

Private Declare Sub CopyMem Lib "kernel32" Alias "RtlMoveMemory" _

(Destination As Any, Source As Any, ByVal Length As Long)

Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" _

(ByVal hWnd As Long, ByVal lpString As String) As Long

Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _

(ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long

Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" _

(ByVal hWnd As Long) As Long

Private Declare Function GetParent Lib "user32" (ByVal hWnd As Long) As Long

Private Declare Function apiSendMessage Lib "user32" _

Alias "SendMessageA" _

(ByVal hWnd As Long, _

ByVal wMsg As Long, _

ByVal wparam As Long, _

lparam As Any) As Long

Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" ( _

ByVal dwExStyle As Long, _

ByVal lpClassName As String, _

ByVal lpWindowName As String, _

ByVal dwStyle As Long, _

ByVal X As Long, _

ByVal Y As Long, _

ByVal nWidth As Long, _

ByVal nHeight As Long, _

ByVal hWndParent As Long, _

ByVal hMenu As Long, _

ByVal hInstance As Long, _

lpParam As Any) As Long

Private Declare Function ClientToScreen Lib "user32" _

(ByVal hWnd As Long, lpPoint As POINTAPI) As Long

Private Declare Function ScreenToClient Lib "user32" _

(ByVal hWnd As Long, lpPoint As POINTAPI) As Long

Private Declare Function PostMessageString Lib "user32" Alias "PostMessageA" _

(ByVal hWnd As Long, ByVal wMsg As Long, _

ByVal wparam As Long, ByVal lparam As String) As Long

Private Declare Function InsertMenu Lib "user32" Alias "InsertMenuA" _

(ByVal hMenu As Long, ByVal nPosition As Long, _

ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As Any) As Long

Private Declare Function CreatePopupMenu Lib "user32" () As Long

Private Declare Function CreateMenu Lib "user32" () As Long

Private Declare Function CheckMenuItem Lib "user32" _

(ByVal hMenu As Long, ByVal wIDCheckItem As Long, ByVal wCheck As Long) As Long

Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _

(ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _

(ByVal hWnd As Long, ByVal nIndex As Long) As Long

Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" _

(ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, _

ByVal Msg As Long, ByVal wparam As Long, ByVal lparam As Long) As Long

Private Declare Function GetMenu Lib "user32" (ByVal hWnd As Long) As Long

Private Declare Function LoadIcon Lib "user32" Alias "LoadIconA" _

(ByVal hInstance As Long, ByVal lpIconName As String) As Long

Private Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" _

(ByVal hInstance As Long, ByVal lpCursorName As String) As Long

Private Declare Function GetStockObject Lib "gdi32" (ByVal nIndex As Long) As Long

Private Declare Function RegisterClassEx Lib "user32" Alias "RegisterClassExA" _

(pcWndClassEx As WNDCLASSEX) As Integer

Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long

Private Declare Function UpdateWindow Lib "user32" (ByVal hWnd As Long) As Long

Private Declare Function SetFocus Lib "user32" (ByVal hWnd As Long) As Long

Declare Function PostMessage Lib "user32" Alias "PostMessageA" _

(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wparam As Long, ByVal lparam As Long) As Long

Private Declare Function DefWindowProc Lib "user32" Alias "DefWindowProcA" _

(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wparam As Long, ByVal lparam As Long) As Long

Private Declare Function GetMessage Lib "user32" Alias "GetMessageA" _

(lpMsg As Msg, ByVal hWnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long) As Long

Private Declare Function TranslateMessage Lib "user32" (lpMsg As Msg) As Long

Private Declare Function DispatchMessage Lib "user32" Alias "DispatchMessageA" _

(lpMsg As Msg) As Long

Private Declare Sub PostQuitMessage Lib "user32" (ByVal nExitCode As Long)

Private Declare Function BeginPaint Lib "user32" _

(ByVal hWnd As Long, lpPaint As PAINTSTRUCT) As Long

Private Declare Function EndPaint Lib "user32" _

(ByVal hWnd As Long, lpPaint As PAINTSTRUCT) As Long

Private Declare Function GetClientRect Lib "user32" _

(ByVal hWnd As Long, lpRect As RECT) As Long

Private Declare Function GetWindowRect Lib "user32" _

(ByVal hWnd As Long, lpRect As RECT) As Long

Private Declare Function DrawText Lib "user32" Alias "DrawTextA" _

(ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, _

lpRect As RECT, ByVal wFormat As Long) As Long

Private Declare Function apiGetWindowLong Lib "user32" _

Alias "GetWindowLongA" _

(ByVal hWnd As Long, _

ByVal nIndex As Long) As Long

Private Declare Function FindWindow Lib "user32" _

Alias "FindWindowA" (ByVal lpClassName As String, _

ByVal lpWindowName As String) As Long

Private Declare Function FindWindowEx Lib "user32" Alias _

"FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, _

ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

Private Declare Function UnregisterClass Lib "user32" _

Alias "UnregisterClassA" (ByVal lpClassName As String, _

ByVal hInstance As Long) As Long

Private Declare Function GetDesktopWindow Lib "user32" () As Long

Private Declare Function MessageBeep Lib "user32" _

Alias "BeepA" (ByVal wType As Long) As Long

Private Declare Function Beep Lib "kernel32" _

(ByVal dwFreq As Long, ByVal dwDuration As Long) As Long

' Enable/Disable Main Access Window

Private Declare Function EnableWindow Lib "user32" _

(ByVal hWnd As Long, ByVal fEnable As Long) As Long

Private Declare Function IsWindowEnabled Lib "user32" _

(ByVal hWnd As Long) As Long

Private Declare Function SetForegroundWindow Lib "user32" _

(ByVal hWnd As Long) As Long

Private Declare Function LockWindowUpdate Lib "user32" _

(ByVal hWndLock As Long) As Long

Private Declare Function SetCapture Lib "user32" _

(ByVal hWnd As Long) As Long

Private Declare Function ReleaseCapture Lib "user32" () As Long

Private Declare Function GetCursorPos Lib "user32" _

(lpPoint As POINTAPI) As Long

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2022-10-31T16:25:54+00:00

    I was expecting two versions of Access to be listed here. Since that is not the case, you may want to search the hard drive for msaccess.exe, and then use More Apps > Browse in this dialog to select the correct one.

    I like "Search Everything" for searching an entire hard drive.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2022-10-31T14:25:37+00:00

    Hi Tom that is correct MDB..

    But if I Open with, what do I select? It doesn't give choices of accdb and mdb

    Was this answer helpful?

    0 comments No comments
  3. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2022-10-31T14:13:05+00:00

    I'm assuming the cut-off filenames have MDB extension.

    It looks like you have 2 versions of Access installed, and files are being opened by the wrong one.

    You can right-click and Open With.

    The declarations may be red if you're running 64-bit Access and your declarations have not been adjusted for that (read up on PtrSafe).

    Was this answer helpful?

    0 comments No comments