Way to display just a form, and not from within the access application?

Bee*

Registered User.
Local time
Today, 08:34
Joined
Aug 22, 2007
Messages
12
Hello. I have a database that is used to record the log in and log off times of staff at the office. The functionality of it I have down to the T.

However, is there a way to just have the main form display by itself, rather than from within the access application? I have the form to open on startup and have also disabled the Display Database Window and Display Status Bar options.

This would almost be perfect if I could get it just to show the form. Can it be done in this version of access? (2003)

Thanks!
 
There is a way but it's not stable nor does it work correctly.

If you want a stand alone application then you should be looking to other development platforms, e.g. Visual Studio.
 
I've had this in my code archives for ages and, sadly, I'm not sure who/where this code originated.

Firstly, you have to have all forms as Popup = Yes, Modal = Yes and it is vital that you have competent error handling in place!

Copy the following code into a new module
Code:
Code:
Option Compare Database

Option Explicit

Global Const SW_HIDE = 0
Global Const SW_SHOWNORMAL = 1
Global Const SW_SHOWMINIMIZED = 2
Global Const SW_SHOWMAXIMIZED = 3

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

Function fSetAccessWindow(nCmdShow As Long)

Dim loX As Long
Dim loForm As Form
On Error Resume Next
Set loForm = Screen.ActiveForm

If err <> 0 Then
loX = apiShowWindow(hWndAccessApp, nCmdShow)
err.Clear
End If

If nCmdShow = SW_SHOWMINIMIZED And loForm.Modal = True Then
MsgBox "Cannot minimize Access with " _
& (loForm.Caption + " ") _
& "form on screen"
ElseIf nCmdShow = SW_HIDE And loForm.PopUp <> True Then
MsgBox "Cannot hide Access with " _
& (loForm.Caption + " ") _
 
& "form on screen"
Else
loX = apiShowWindow(hWndAccessApp, nCmdShow)
End If
fSetAccessWindow = (loX <> 0)
End Function

You can set up your Form to Load when the app Opens and in the Form_Load event call the function using

Call fSetAccessWindow(0)

Having said that, I have to emphasize what vbaInet said: this and all other hacks I've seen to accomplish this task are unreliable in most major apps. If this app is strictly a single Form database for people to Sing On/Sign Off Shift with, it might work fine for you. I'd create a separate app, linking to the Table, to do any manipulating/reporting you need to do with the data.

Linq ;0)>
 
Thanks for the code Linq! Unfortunately I have buttons on the form that the users use to lock their workstations with and the buttons aren't responsive at all. I think this could be a lost cause right now :-(

Your help is appreciated nonetheless!
 
In the end the only reliable way of really doing this is as vbaInet suggested, using another language.
 

Users who are viewing this thread

Back
Top Bottom