?
Solved

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

Posted on 2003-02-22
3
Medium Priority
?
283 Views
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.


0
Comment
Question by:tutor_al
3 Comments
 
LVL 4

Accepted Solution

by:
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

Change_Bye:
Exit Function

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

Expert Comment

by:shanesuebsahakarn
ID: 8001093
Have a look here to hide the database window:
http://www.mvps.org/access/api/api0019.htm
0
 

Author Comment

by:tutor_al
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.
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

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

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
A Case Study of using the Windows API to provide RS232 communications capability in Access without the use of Active-X controls.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…

571 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