473,386 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Hiding the Access 2013 Application during database use...

49
how in the world do i hide the database window? The thing takes up the whole screen, all my users need are the forms I created... used to be a check box that would let you not display the application... that feature seems to be gone in 2013 =/
Dec 30 '14 #1
23 10972
twinnyfo
3,653 Expert Mod 2GB
Here is what I use:

I created a separate module called "modFormUtilities". In it are several functions.

Whenever you use these functions, your forms should all be set to Modal and Pop-up. This allows your Forms to have control of the environment, rather than the DB window.

There are some comments in the RestoreForm Function that explains how to use it. Let me know if you run across any snags.

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. '==============================
  5. '  CONSTANTS FOR DBASE WINDOW
  6. '==============================
  7. Public Const SW_HIDE = 0
  8. Public Const SW_SHOWNORMAL = 1
  9. Public Const SW_SHOWMINIMIZED = 2
  10. Public Const SW_SHOWMAXIMIZED = 3
  11.  
  12. '==========================
  13. '  DBASE WINDOW FUNCTIONS
  14. '==========================
  15. Public Declare Function IsWindowVisible Lib "user32" _
  16.         (ByVal hwnd As Long) _
  17.     As Long
  18. Public Declare Function ShowWindow Lib "user32" _
  19.         (ByVal hwnd As Long, _
  20.         ByVal nCmdShow As Long) _
  21.     As Long
  22.  
  23. '============================
  24. ' FORM MANAGEMENT FUNCTIONS
  25. '============================
  26.  
  27. Public Function fAccessWindow(Optional Procedure As String, _
  28.     Optional SwitchStatus As Boolean, Optional StatusCheck As Boolean) As Boolean
  29. '****************************************************************************************
  30. '* Purpose:  Controls the behavior and appearance of the Daatabase window               *
  31. '*           residing on the form, and hence, we reduce the overall size of the FE DB.  *
  32. '* Accepts:  Procedure -    describes the behavior requested                            *
  33. '*           SwitchStatus - (optional) instructs the procedure to switch the current    *
  34. '*                          status of the DB Window                                     *
  35. '*           StatusCheck -  (optional) allows the procedure to check the current status *
  36. '*                          of the DB window to determine whether or not to initiate a  *
  37. '*                          change                                                      *
  38. '****************************************************************************************
  39. On Error GoTo EH
  40.     Dim dwReturn As Long
  41.     If Procedure = "Hide" Then
  42.         dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
  43.     End If
  44.     If Procedure = "Minimize" Then
  45.         dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMINIMIZED)
  46.     End If
  47.     If Procedure = "Normal" Then
  48.         dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWNORMAL)
  49.     End If
  50.     If Procedure = "Show" Then
  51.         dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
  52.     End If
  53.     If SwitchStatus = True Then
  54.         If IsWindowVisible(hWndAccessApp) = 1 Then
  55.             dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
  56.         Else
  57.             dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
  58.         End If
  59.     End If
  60.     If StatusCheck = True Then
  61.         If IsWindowVisible(hWndAccessApp) = 0 Then
  62.             fAccessWindow = False
  63.         End If
  64.         If IsWindowVisible(hWndAccessApp) = 1 Then
  65.             fAccessWindow = True
  66.         End If
  67.     End If
  68.     Exit Function
  69. EH:
  70.     MsgBox "There was an error resetting the Database Window!  " & _
  71.         "Please contact your Database Administrator.", vbCritical, "Error!"
  72.     Exit Function
  73. End Function
  74.  
  75. Public Function RestoreForm(FormName As String)
  76. '**********************************************************************************
  77. '* Purpose:  Manages the database window, keep the current form on top of others. *
  78. '* Accepts:  FormName is the name of the Form which you want to restore           *
  79. '* Returns:  N/A                                                                  *
  80. '*   Usage:  Add "RestoreForm Me.Form.Name" to the OnOpen event of a form         *
  81. '**********************************************************************************
  82. On Error GoTo EH
  83.     fAccessWindow "Minimize", False, False
  84.     DoCmd.SelectObject acForm, FormName
  85.     DoCmd.Restore
  86.     Exit Function
  87. EH:
  88.     MsgBox "There was an error restoring the Form.  " & _
  89.         "Please contact your Database Administrator.", vbOKOnly, "Error!"
  90.     Exit Function
  91. End Function
Hope this hepps!
Dec 30 '14 #2
sooli
49
got error from click event... tried changing to modal..and it didn't help (one form will have to be non-modal so the boss man can copy and paste from the form opened by a click event.)

Error I am getting:

The expression On Click you entered as the event property setting produced the following error: constants, Fixed-length strings, arrays, user-defined types and Declare statements not allowed as Public members of object modules
*The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure]
*There may have been an error evaluating the function, event or macro


I made sure none of your sub names were the same as mine... so * 1 is not the issue...
Dec 31 '14 #3
twinnyfo
3,653 Expert Mod 2GB
This code should not run on any OnClick events. The error described does not appear to be associated with any of the code provided, as the error trapping included would not generate any such error. How are you calling the code? It should be in the OnOpen Event of the form.

You can still use Modal for all forms (as the most recently opened form will open on top. You could either close that form after you copy and then paste into the original form or have other ways to transfer data.
Dec 31 '14 #4
sooli
49
I put the code into the OnOpen event. Error didn't occur till I entered the code, when I removed the code the error went away. When I debugged, it sent me straight to your code where the constants were defined. I'll play with it a bit and see if I can resolve - maybe pinpoint the exact spot that is causing the error... for now everyone is happy with the database as is... so this will be something to provide in a version update later. Thanks for you assistance on this and my other issue.. still trying to work that one out as well...
Jan 4 '15 #5
twinnyfo
3,653 Expert Mod 2GB
Is the code I posted in a separate module--all by itself and NOT in a Form. Your Form should only have the following line in the OnOpen event:

Expand|Select|Wrap|Line Numbers
  1. RestoreForm Me.Form.Name
You also did not tell us what the error was when you debugged.
Jan 5 '15 #6
sooli
49
I did not make a separate module... i put it at the head of the module for the main form. I will try it as a separate module =)

When I debugged, it just put me on the 1st line of code where the constants were declared. I didn't get an explanation =( Only error I got was the one I posted earlier.
Jan 6 '15 #7
jimatqsi
1,271 Expert 1GB
Twinnyfo, this looks to be very useful. I'm having some trouble getting Access 2010 Runtime to behave. People are able to see the database window and even change queries!

Are there any version restrictions with this code?

Perhaps this could be the basis of an article. :)

Jim
Jan 6 '15 #8
twinnyfo
3,653 Expert Mod 2GB
sooli,

Have you made any progress on this?
Jan 7 '15 #9
sooli
49
Twinnyfo!!!! You are AWESOME!!!! I got it to work and didn't have to tweak any of your code! I just had to call it properly!

Sorry took so long to get to this point! Plate is overflowing!

Question... is there anyway to keep the user from bringing the window back? You cannot see it while actively using the database... which is great, however if you hover over the areo peak, you can bring it right back up... and if I try to go back to design view it closes the database...

I did find that I can open the database using shift... and get to the design view which is fine... and I have the working copy of the database set so that navigation and menu's are disabled... so they can't do anything with it... just want it to not be retrievable at all by the user.
Mar 6 '15 #10
Brilstern
208 100+
sooli,

Assuming you login with a unique username you can set form properties on load.

Example: (pseudo code)
Expand|Select|Wrap|Line Numbers
  1. If Me.Username = "Admin" Then
  2. Me.Control.Visible = true
  3. Else
  4. Me.Control.Visible = False
  5. End If
This button could allow for a close option for you.

To answer your other question:
Set the On Close Event to quit the database. This would force the database to close if a user uses the close in the navigation.

Another option would be to disable the close in the navigation altogether in the form properties. This would force the user to log out.
Mar 6 '15 #11
twinnyfo
3,653 Expert Mod 2GB
@sooli,

When I create my DBs, I always do this:
  1. There is always a Front-End/Back-End structure, so the DATA is always separated from the CODE. If your Front-End (the Code) crashes, then you don't lose your data. The data side very seldom (if ever) crashes.
  2. When the Front end if opened, it checks to see how long it has been since the DB has been updated. My schedule is every six hours. If it has been six hours, the DATA is backed up again (just in case the data does crash).
  3. My shortcut does not point to the DB itself, but to a MS Scripting file, which copies the DB to the local user's machine. If the local version crashes, it does not corrupt the master copy of the front-end.
  4. My Front-End is ALWAYS compiled (.accde or .mde file), so no one can access the code or modify any of the objects.
  5. All navigation controls are disabled in the DB (including the Nav pane, shortcut menus, etc.). I have not found an effective method for bypassing the "Shift-Key" method. Any experts out there know a simple way to do this?
  6. My DBs log who has accessed the DB and assigns permissions to the user that I establish. Each user can only see what I let them see.
  7. All forms are locked down (no built in controls, like Minimize, maximize and close). My users can only do what I want them to do with the forms. Navigation ultimately leads them to either do their job or exit the DB.

I use these principles because people are inherently inquisitive and like to snoop around DBs. I do everything I can to prevent this.

Here are some links to a couple articles that may assist in these tasks:

Working with Front-Ends and Back-Ends

MS Access User Permissions
Mar 6 '15 #12
Brilstern
208 100+
Nice business rules twinnyfo. Going to have to put those in the toolbox for future projects.
Mar 6 '15 #13
twinnyfo
3,653 Expert Mod 2GB
@Stevan,

I have been DBasing for about 20 years, and, unfortunately, I learned just about everything I know via bad experience. Up until maybe 5-6 years ago, I did not know what DB normalization was. I practiced those principles almost exclusively, but it was not because I was taught the principles. I learned--by creating poorly designed DBs--that there were certain principles that made for a better design. Now I am able to talk intelligently about those principles.

Thanks to this site, primarily, I have learned much more about good design and programming concepts that have both re-inforced many practices and corrected some others. I want to spare others my bad experiences by guiding these young Jedis in the good ways of the Force.

I don't know what experience you have, but thanks for joining us!
Mar 6 '15 #14
Brilstern
208 100+
@twinnyfo,

Now that we have successfully hijacked sooli's thread (hah just joking!) we appreciate the willingness of those that know to pass on the information.

I built my first database in 2011 and have found myself building one here and there ever since. My goal is always to make my next DB better than my last. Bytes has truly helped me do that!
Mar 6 '15 #15
sooli
49
@twinnyfo,

I would love to create the .accde! but it seems access 2013 doesn't afford that luxury. Or I need an addin that I don't know about. I guess when they took away the ability to hide the database with a check box in the database properties, they also removed that feature. The .accde is the one that actually keeps the users from being able to get to the database itself, or make changes to the forms.. i have all that locked down to an extent - but as you are aware... curiosity can lead to sneaky back door access... My boss didn't want the database to have a password to access it, so I was careful to create my own switch with nothing other than what the users are supposed to be able to do, and a password protected menu for administration which is reached thru a cmd button. The database is split so the user only has the front end, and so far I have only had one nosey nelly that has found the tables, and he actually went on the server and opened the database directly... he has been reprimanded for this, and everyone was made very aware that the database itself is not for their use EVER.

I tried to eliminate the upper right controls, but to my dismay, when I used a cmd button to minimize the form, the user was not able to bring it back, so I had to leave those on the screen because the user wants to be able to minimize the data base when not actively using it, and the general consensus was to leave the database open/available for the whole shift, rather than open it every time they needed to enter something.

I have a script on my system that runs a backup of the database every hour, since we have it residing on a san server, and have already experienced the "reason for having a san" fallacy... my database in its entirety just up and vanished one night, thankfully I was in it just as it happened and i was able to contact my server admin immediately and he was able to recover it, though we lost 6 hours worth of data, since his back up only runs every 8 hours. we are a 24x7 operation...

I too try to follow the same guidelines you posted, these came about, fortunately when i learned how to design in Access, eon's ago... in school. That was part of my Office training when Windows 95 was still around... over the years, as MS has made changes to the product itself, I was able to continue manipulating things to my personal whim, until 2013 came out... now I am finding the basic things that made Access a great "small" customizable database have abruptly become extinct.

Anyway... the code you posted previously works great, except that windows aero peek allows you to bring it back.. useless but back none the less... so I will just let my crew know, not to click the aero peek unless they want to restart the database.

I greatly appreciate your assistance!
Mar 9 '15 #16
sooli
49
@ Stevan Bias - I actually have something like your code for my admin functions. =) I am using it for subforms that only the admin can get to, and he loves it.

I do have the X on the switch set to close and compact the database, on all other forms the X takes the user back to the switch, as people are creatures of habit and love that red X, but hate to have to keep re-opening the database... lol
Mar 9 '15 #17
twinnyfo
3,653 Expert Mod 2GB
sooli,

I use Access 2010 at work, and did some research and found nothing about 2013 that says you can't create .accde files. Are you perhaps looking in the wrong places?

In 2010, go to File, Save & Publish, Make ACCDE. 2013 should have a similar enough interface that it should be there, unless you have some form of limited version of Access 2013....
Mar 9 '15 #18
sooli
49
I tried to save as accde and ran into issues... i'll try to work them out, but in the meantime...

I still need a work around for using the icon in the task bar to bring the database back on the screen when it is minimized... it brings the application window back too. Boss is now wanting to eliminate the possibility of anyone trying to access the tables and making their own updates. I have the database itself password protected, so if a user attempts to open the mdb file, it prompts for password and if you get it wrong 3 times, the application just closes... I used a form inside the database to do this... was quick and simple way - without affecting the users ability to still update tables using the accdb file.

Trying to encrypt a sample now... to test that out... but fear that will require a password for the users to enter... and he doesn't want that. (we have too many passwords to remember as it is...)

Currently I have the properties set so navigation and menus are disabled, which for most of my users is sufficient. However... the shift button over-rides this...

I was thinking maybe I could Hide the list of tables? this way if someone were to gain access to the navigation field, they wouldn't be able to see them? but I wasn't sure what this would do to usability? Will the tables still be linked?

I tried it earlier today, bringing them back was a little tricky cause I didn't know how... I had done it in separate groups... so when i tried to bring them all back at once... I couldn't... there wasn't even an option... imagine my panic! lol.

If I hide them, will it stay hidden when the user copies the front end to the desktop - and will they stay linked? I am brain storming... so sorry if this seems to be something I should be able to test on my own... i cannot exactly use my users as guinea pig...
Mar 20 '15 #19
jforbes
1,107 Expert 1GB
I think the root of the problem here has to do with storing sensitive information in a place where people that should not have permission can get to it. This really isn't so much an MS-Access problem that you are running into, but a Permission/Security issue. Access wasn't really created to address permissions... well it dabbled in it for a while early on and then backed off.

There are a few common ways to address permissions/security when it comes to data, there are more, but I'm only gonna touch on three:
  • File System permissions is a very effective method by keeping sensitive information on a FileShare and then either allowing or taking away permissions based on the users Windows login. It is a much better way at securing data than attempting to lock down MS-Access because the permission are managed and enforced by a Server on the Network vs embedding security in a file.
  • Encryption is handy and sometimes the best way depending on the applications needs, but I really wouldn't think this would be an option for you as it tends to take a considerable amount of development and overhead when running.
  • Network Security can be a great way to lockdown data as that is one of its primary functions. Doing this would take either a custom application or use of an application that provides this for you. One application that is often used for this is MS-SQL Server.

If you can use a SQL Server, I would recommend it as there are a lot of benefits in addition to taking care of the problem you are running into for this post. You can setup the authentication based on the Logged in Windows User so that only people that can login to you network can access data as well as you can give and remove permissions on a user by user basis.

The other option, if you can't talk your Boss into a SQL Server, is to split your backend database based on group roles. You don't have to have only one backend database. You can split it by job function and place data specific for a certain job function into it's own FileShare on your network. Then control users permission on the FileShare. This way Jimmy from out in the shop can enter whatever he needs to enter, but can't see all the interesting comments Mary in HR is entering about him into the same system. SQL Sever would be better, but if your Boss has short arms and deep pockets, this approach may work for you.
Mar 20 '15 #20
sooli
49
well, the sql option is not really an option - I have the file on the server it resides locked down so no one on the outside can get in, but what I am having issues with now is the pesky navigation screen giving access to all the tables if a user happens to figure out how to bring it back. All the linked tables are accessible if the navigation pane is unlocked, which is easy to do, just hold shift while opening the front end. I only have 2 groups of folks, Admins and the users... and I have that separated by a password. I discovered I could hide the linked tables from view if the navigation pain happens to be unlocked... just wasn't sure if it would cause any issues. Being that I work 3rd shift, and the only other person I can use as a guinea pig is a "user" I didn't want to go that route to verify it would still provide access to input like it is supposed to. It looks like it works... so I guess I'll just give it a run for a little while and see how it goes.

In order for my users to be able to input data, they have to have read write access to the folder the database is in right? And even if I could modify that, I don't think it has any bearings on their ability to open the "linked" tables in the application.

Thanks everyone for your input and suggestions... IF anyone figures out a work around for the AERO PEEK issue... please let me know.
Mar 23 '15 #21
twinnyfo
3,653 Expert Mod 2GB
Try this:

Expand|Select|Wrap|Line Numbers
  1. Public Sub DisableByPass()
  2.     ChangeProperty "AllowBypassKey", dbBoolean, False
  3. End Sub
  4. Private Function ChangeProperty(strPropertyName As String, _
  5.     varPropertyType As Variant, varPropertyValue As Variant) As Integer
  6. On Error GoTo Err_ChangeProperty
  7.     Dim dbACC As DAO.Database
  8.     Dim prpProperty As Property
  9.  
  10.     Set dbACC = CurrentDb()
  11.  
  12.     'Property exists, so set its Value
  13.     dbACC.Properties(strPropertyName) = varPropertyValue
  14.     ChangeProperty = True
  15.  
  16. Exit_ChangeProperty:
  17.     Set dbACC = Nothing
  18.     Exit Function
  19.  
  20. Err_ChangeProperty:
  21.     If Err.Number = 3270 Then       'Property not found
  22.         'Since the Property isn't found, create it!
  23.         Set prpProperty = _
  24.             dbACC.CreateProperty(strPropertyName, varPropertyType, varPropertyValue)
  25.         dbACC.Properties.Append prpProperty
  26.         Resume Next
  27.     Else
  28.         'Unknown Error
  29.         ChangeProperty = False
  30.         Resume Exit_ChangeProperty
  31.     End If
  32. End Function
This will disable the Shift-Key workaround.
Mar 23 '15 #22
Rabbit
12,516 Expert Mod 8TB
Because of the nature of Access, anything that you do can be undone by a user. Even disabling the shift key bypass.

Because of this drawback to Access, it is highly recommended not to use Access if there is a real need for security.
Mar 23 '15 #23
NeoPa
32,556 Expert Mod 16PB
Making the Database Window hidden via code can be done by first selecting something in the window, then hiding that window. Here's some code for that :
Expand|Select|Wrap|Line Numbers
  1. Call Application.Echo(EchoOn:=False)
  2. Call DoCmd.SelectObject(ObjectType:=acForm, InDatabaseWindow:=True)
  3. Call DoCmd.RunCommand(Command:=acCmdWindowHide)
  4. Call Application.Echo(EchoOn:=True)
This uses calls to Application.Echo() because when this code is run when the window is already hidden it can cause a flicker.
Oct 21 '15 #24

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: skiz | last post by:
I have an application written in ms access 97. Just recently certain queries have been giving various errors -- one of which is "there was an error executing the command". When I ran the...
6
by: SteveS | last post by:
Hello All. I have an asp.net application with 3 different assemblies. They are like this: 1) Assembly: PublicSite (This contains the website UI) Root namespace: PublicSite 2) Assembly:...
3
by: George H. Slamowitz | last post by:
Hello All I am trying to convert a MS Access 2000 application to a VB application (Just Started Yesterday) I am using Visual Studio .NET 2003 utilizing Visual Basic .NET I think I have a...
22
by: Jordan S. | last post by:
SQL Server will be used as the back-end database to a non trivial client application. In question is the choice of client application: I need to be able to speak intelligently about when one...
5
by: BA | last post by:
Hi there I am trying to write an "application" in Access 2000, that displays a front end and allows the user to interact with the database without seeing Access loaded, in the background, nor on...
1
mikek12004
by: mikek12004 | last post by:
I have a access 2002 application (a file with MDE extension) which when you execute it access 2002 opens and you insert/view/modify data through a series of user-created forms. Assuming that they are...
0
by: steveradaza | last post by:
Sir,Good Day..I am a newbie here and i am just learning the usage of microsoft access..can you help me solve my problem in making a running balance in a query of microsoft access 2013 of my In and...
4
by: nomeepk | last post by:
hi, i am using access 2013, Is there a way i can make this Access Database online, so i can access and use it from anywhere in a Browser? Regards.
5
by: jimatqsi | last post by:
I'm looking for information about compatibility between Access 2013 and Access 2003. I've been approached by a firm that wants to begin upgrading their systems. I want to know if it is reasonable...
0
by: LeoVBNET | last post by:
Hi Because VS 2013 dropped SQL COMPACT databases, I need to convert Access 2013 databases into SQL COMPACT in order to be able to use Linq to SQL in VB 2013. Anybody can help me? Thanks
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.