Functionality differences between .accdb and .accde

CraigBaker

New member
Local time
Today, 15:09
Joined
Apr 7, 2024
Messages
9
Hello all,

I've been working on an Access project for two years and have been able to answer most of my questions using Google. Many of the answers have come from this site, so thank you all very much. :)

I have not been able to find any help with this problem so I've decided to try directly.

I write my code in the accdb and distribute an accdr. This is created by renaming the accde I get when doing a Save As.

My specific problem is that I've written some code that will position reports on the same monitor where the report was called, usually from a button. All the forms and reports are Pop Up. The code works perfectly when I run the accdb file. It does not work when running the accdr and it does not work with the accde either.

To position the report, I call a sub procedure from the Report_Open handler. This procedure is defined in my Utilities module and is called CentreWindow. It is defined as
Code:
Public Sub CentreWindow(obj As Object, pCallingForm As Form)

The implementation uses Windows API calls to find the monitor displaying pCallingForm and then position obj in the middle of the monitor. The Windows API MoveWindow procedure is used to do the positioning.

It is defined as
Code:
Public Declare PtrSafe Function MoveWindow Lib "User32.dll" (ByVal hwnd As LongPtr, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Boolean) As Boolean

This exact setup has worked with forms for over a year (hence obj being an Object and not a Report) but I can't get it to work for reports.

If I place the call in Report_Open I get this error.
Error 2501 occurred. The OpenReport action was canceled.

If I place the call in Report_Load I get no error, but the report is not moved.

This is not essential functionality so I'm just leaving it out for now, but it does make me wonder what I'm missing regarding the differences between accde and accdb files. Are there known differences? Am I perhaps making some kind of mistake that just doesn't show up in the accdb? I'm sure I've seen this once before but I can't remember the exact problem for that one. It does make me more suspicious about the equivalence of the 2 formats though.

I'd appreciate any information. I'm using Office LTSC Professional Plus 2024, Version 2408 (Build 17932.20496).

Thanks,
Craig
 
One thing you could try is add error handlers to your code, if you don't have any. ACCDEs usually just quits silently during an error, if you don't have a handler to let you know it happened. So, you may be missing something when the ACCDE version doesn't work.
 

Users who are viewing this thread

Back
Top Bottom