How to Create MDE and suppress all Windows & Print dialog boxes.

Posted on 2003-02-22
Medium Priority
Last Modified: 2008-02-01
I am able creating an MDE file with Access. However, but I do not want Access to open up to the Access Enviornment. All I'd like to do is run the .MDE, let it run its code (it prints PDF reports) without any windows or print boxes to open or be displayed. Much like a batch file with echoes off ( no screen messages).

I did read somewhere about setting the Application.object to hide or something like that and I also need to hide the print dialog box. I open to any suggestions.

Question by:tutor_al
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

nmilmine earned 300 total points
ID: 8001075
Try running this code prior to making your MDE file.  Remember to back up your database first.  

'This turns all the protection on

Sub SetStartupProperties()

ChangeProperty "StartupShowDBWindow", dbBoolean, False
ChangeProperty "StartupShowStatusBar", dbBoolean, False
ChangeProperty "AllowBuiltinToolbars", dbBoolean, False
ChangeProperty "AllowFullMenus", dbBoolean, False
ChangeProperty "AllowShortcutMenus", dbBoolean, False

ChangeProperty "AllowBreakIntoCode", dbBoolean, False
ChangeProperty "AllowSpecialKeys", dbBoolean, False
ChangeProperty "AllowBypassKey", dbBoolean, False

End Sub

'This part is the function used to make the changes

Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
Dim dbs As Database, prp As Property
Const conPropNotFoundError = 3270

Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True

Exit Function

If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function
LVL 41

Expert Comment

ID: 8001093
Have a look here to hide the database window:

Author Comment

ID: 8051659
Thanks for the code. I have trouble running the Function. Whats the easiest way to run it?

The only thing really left to do is suppressing the print box when the PDF reports are printing. Let me know if there is a method to do that.

FYI: Another way to hide the Access window was to set the Application property to Usercontrol = False.
Found in the help section. Have you ever used that before?
Thanks again.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question